-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: lint with error #6296
Comments
This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue. Please see the Contributing Guide for how to create a Code Reproduction. Thanks! |
It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot. Have a great day! |
That's still an issue, even with 4.7.3 |
Getting this same error in Capacitor 5 as shown here: https://github.com/RaphaelWoude/capacitor-native-settings/actions/runs/4739878824/jobs/8415109453?pr=32 |
The problem is definitely still there, and it is completely blocking our release now. It seems to be very simple-- they have deprecated the use of 'getIdentifier' in Android API 33, because it's hard to optimize. The 'getIdentifier' method is used in: Our company's mobile app project is completely stuck because our application has a hard dependency on package androidx.camera:camera-camera2:1.2.0, which absolutely requires Android API 33. As soon as we moved from API 32 to 33, we are stuck with this error. It is very easy to create a reproduceable capacitor project that shows this problem. All you need to do is edit the 'variables.gradle' file in the android project folder and set compoleSdkVersion=33 and targetSdkVersion=33. I would encourage the capacitor team to please fix this ASAP! |
Here are the steps to reproduce this starting from an empty installation of Node.JS:
You will get the error during the build:
TestProject\node_modules@capacitor\android\capacitor\src\main\java\com\getcapacitor\plugin\util\AssetUtil.java:239: Error: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi] There is a reference to a "full lint text report", which contains the following:TestProject\node_modules@capacitor\android\capacitor\src\main\java\com\getcapacitor\plugin\util\AssetUtil.java:239: Error: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi] Explanation for issues of type "DiscouragedApi": 6 errors, 0 warnings (8 errors filtered by baseline lint-baseline.xml) |
@ejohanson-vi3 thanks for the report here. However, Capacitor 4 does not support targeting SDK 33, which is why you're seeing those errors when trying to change that target value. Capacitor 5 makes all the needed changes needed for your application to correctly support targeting SDK 33. In our testing, this error is not present with Capacitor 5, and we have no plans to support targeting SDK 33 with Capacitor 4. You can upgrade to the latest beta using the |
Ok this is a production grade app that is released to the public, so I'd prefer not to use beta tooling. Is there a target release date for Capacitor 5? If you're desperate to get this working, you can hack it by adding the following line: |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out. |
Bug Report
Capacitor Version
Platform(s)
Android
Current Behavior
gradle lint returns
Expected Behavior
pass without error, or, at least, errors in my own project.
Code Reproduction
Other Technical Details
npm --version
output:node --version
output:pod --version
output (iOS issues only):Additional Context
The full lint-results-debug.txt is as follows:
The text was updated successfully, but these errors were encountered: