Why do we get this error in Android Studio 3.0 RC1?
com.android.dx.cf.code.SimException:
default or static interface method used without --min-sdk-version >= 24
According to the android docs, the feature "Default and static interface methods" is compatible with Any min-sdk version.
I tracked this down to a java-library that calls Comparator.naturalOrder() - which has been added in API level 24.
So I would not expect any error-message at all for this code in a java-library.
When I use the code in my own android-app or lib java code, I see the correct lint message: "Call requires API level 24)"
Is the error-message wrong or am I missing something?
I just found out that it works as expected when I activate the D8 dexer which is planned to be the default for Android Studio 3.1
In the project gradle.properties, add:
android.enableD8=true
Now the code compiles as expected and I still get the expected linter messages.
If the java-library that you're talking about was guava, you can try to upgrade it to the latest android-specific build
implementation 'com.google.guava:guava:23.0-android'
This fixed for me
From guava v24 we have two alternative versions: Android or JRE. So, in this case you need to include the dependency as:
compile 'com.google.guava:guava:24.1-android'
Find all the details within the repo: https://github.com/google/guava
If this error occurs due to Guava, then the solution, as per the official documentation from Google is:
https://github.com/google/guava
Change the dependency to (version is current as of this writing):
api 'com.google.guava:guava:27.0-android'
This fixed the issue for me.
Related
I'm working with flutter and I'm getting this error while I was trying to add lutter_bluetooth_serial to the pubspec.yaml. This is the error that I get.-->"The plugin flutter_bluetooth_serial uses a deprecated version of the Android embedding. To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs. If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration." ---->I don't know how to solve this issue Can you help??? I also changed to buildgradle->defaultConfig{
minSdkVersion 19 };
flutter_blue, the author of package should update the package,to match the flutter version.
https://pub.dev/packages/flutter_blue
There is nothing you can do. Either use an other package or ask the package developer to fix the problem.
you can try
https://pub.dev/packages/flutter_blue
do your stuff, this package has function like flutter_blue.
My Android Studio project has minSdk 10.
It still uses legacy libraries.
Indeed the build.gradle file contains:
android.useAndroidX=false
android.enableJetifier=false
I imported a Maven legacy dependency that requires minSdk 14.
implementation 'com.android.support:webkit:28.0.0'.
Obliviously I got a compiling error. Since I don't want to increase the project minSDK, I tried to ignore the error. To do that, I added this line to the Manifest:
<uses-sdk
tools:overrideLibrary="com.android.support.webkit" />
The problem is that I still can't compile the project since the error message asks to do "ovverrideLibray" for the new AndroidX library, and not for the old legacy library!
use tools:overrideLibrary="androidx.webkit" to force usage
(I just want to ignore a minSdk library error, who cares if the library is new or old!)
How can I solve this problem?
This project targets some old devices, and switching to AndroidX would be worse. I just want to add that legacy library ignoring the error.
Any solution? Thank you in advance.
I am using the Gradle Retrolambda Plugin in my Android library. The integration works well.
The Android Gradle Plugin, however, is annoying me. It announces that it can support Java 8 features, via de-sugaring. It suggests that I stop using Retrolambda:
WARNING: One of the plugins you are using supports Java 8 language features. To try the support built into the Android plugin, remove the following from your build.gradle:
apply plugin: 'me.tatarka.retrolambda'
To learn more, go to https://d.android.com/r/tools/java-8-support-message.html
For technical reasons, I have decided not to follow this suggestion. Retrolambda generates version 50 class files, while the AGP generates version 52 classfiles. The version 50 class files are compatible with a broader spread of consumers.
As per Google issue 147311698, I would like to permanently suppress this warning message, so that it doesn't clutter my build output. Is there some configuration / Groovy code I can use to target and suppress this specific message?
My compiledsdkversion is 23. My Android support library has a 24.0.0-alpha1designation at the end of the string which declares it on my gradle app file. Gradle is compiling with errors stating that the support library should not use a different version than the compiledsdkversion.Any ideas on how to get rid of this error. I don't know how to update the compiledsdkversion.
You should use the latest stable version of the Support Library, which is currently 23.2.1 as per the release notes.
Having issues with appcompat-v7 and compileSdkVersion, the app build target is API 10 so I set compileSdkVersion 10 to compile the code safely, as expected it works well with support-v4: the app compiles and runs on API 10 devices.
Then I want to add appcompat-v7 to dependencies (or replace v4 with it) and perform clean re-build of the app without any changes at the code or resources, build fails at the R generation stage unless the compileSdkVersion is set to a higher value.
I understand it as the v7 library is using some values unavailable at API 10. It raises the question of how someone can continue to write safe code and use v7 without need to manually check API level of each variable and method. Is there a way to keep using v7 (that is claimed to be "designed to be used with Android 2.1 (API level 7)") and compileSdkVersion 10 ?
Apparently at the newest Intellij version Lint produces errors if the methods form the API above minSdkVersion is used (can be enabled/disabled at Preferences-Inspections, expand Android Lint at the list, look for Calling new methods on older versions or use "NewApi" annotation to suppress the error if needed).
That'll have to do until some kind of dynamic resources compilation is introduced. I'm going to leave the question here for a future reference.