FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
6 issues were found when checking AAR metadata:
1. Dependency 'androidx.appcompat:appcompat-resources:1.6.1' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion
of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
2. Dependency 'androidx.appcompat:appcompat:1.6.1' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion
of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
3. Dependency 'androidx.activity:activity:1.6.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion
of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
4. Dependency 'androidx.core:core-ktx:1.9.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion
of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
5. Dependency 'androidx.core:core:1.9.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion
of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
6. Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Recommended action: Update this project to use a newer compileSdkVersion
of at least 33, for example 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
i just want to solve it
Related
I am trying to import native libraries(.so files) into the android studio.
I created a jniLibs folder and directory with ABI name and respective .so files in it.
made changes in build.gradle and tried to load them.
Then, the error occurs of java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "pthread_cond_clockwait"
can someone give idea how to solve this issue?
That API is only available on API 30+ devices (note the __INTRODUCED_IN(30)):
int pthread_cond_clockwait(pthread_cond_t* __cond,
pthread_mutex_t* __mutex,
clockid_t __clock,
const struct timespec* __timeout) __INTRODUCED_IN(30);
You're probably seeing the problem on an older device.
As per the Android documentation, it is important to realize that the NDK API level is your app's minimum supported API level:
The API level you build against with the NDK has a very different meaning than compileSdkVersion does for Java. The NDK API level is your app's minimum supported API level. In ndk-build, this is your APP_PLATFORM setting. With CMake, this is -DANDROID_PLATFORM.
So you need to compile the library with the correct NDK API level:
Problem: Your NDK API level is higher than the API supported by your device.
Solution: Set your NDK API level (APP_PLATFORM) to the minimum version of Android your app supports.
implementation 'org.apache.poi:poi:5.0.0'
above dependencies work fine when I run on the emulator/phone using Run 'app' but
when I try to build apk then I got the below error.
com.android.tools.r8.a: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
I try below
if I remove dependencies it works fine.
if I update minSdkVersion 21 to 26 then it works fine.
so my problem is
I want to use minsdkversion 21 and also that dependency(this feature(EXCEL FILE) only available to sdkversion>=26)
so how can I achieve the same?
THANK YOU IN ADVANCE.
Right now this is not possible. D8 will only allow compiling code which use invoke-custom and method handles for a minSdkVersion of 26 or higher, as that is the first version where these features are supported by Android.
There is an open issue on lifting that restriction. However, depending on the code in the library this might just end up as a runtime error if the code using invoke-custom and method handles will be hit at runtime on a device with API level of 25 or below.
The reason you can run you code from Android Studio, is that when debugging on a device or emulator, Android Studio will "artificially" raise the minSdkVersion for the build to that of the device or emulator attached. This is to provide the best development experience by taking advantage of what the device or emulator supports.
You can use version 4, it works for me
implementation 'org.apache.poi:poi:4.0.0'
implementation 'org.apache.poi:poi-ooxml:4.0.0'
I am using Android Studio 3.0 with the updated gradle plugin.
I need to use the releaseImplementation keyword in my build.gradle file as I only want the library specified (ACRA) to be built in release. The reason I only want to build ACRA in release is that I've read that Android Studio instant run does not work well with ACRA.
releaseImplementation 'ch.acra:acra:4.9.2'
The problem is, however, that it's a library so I also need to use the api key so I can transitively export in apis to the modules using the library.
api 'ch.acra:acra:4.9.2'
Is it possible to use both keywords or is there a composite keyword to use?
releaseImplementation 'ch.acra:acra:4.9.2'
api 'ch.acra:acra:4.9.2'
In Android Studio 3.0 and newer, the Android Gradle Plugin supports the new Java Library plugin configurations that allow more granular control of dependencies.
As described here, the new Gradle Dependency configurations are available for flavor- or build-type-specific dependencies.
If you wish to use the api dependency configuration for the release build Type, you would add the following:
releaseApi 'ch.acra:acra:4.9.2'
This is the "composite keyword" that you are describing. No additional dependency needs to be specified.
I have a android library with com.android.support:appcompat-v7:23.0.1 dependency in the gradle.
Say any applicaion with different version com.android.support:appcompat-v7:23.3.0is in the build.gradle of that application uses my library.
Below are the list of questions I have doubt.
which version does the android take? Lower one or Higher one? How do i see it?
Won't there be any conflict if i use different version like 24 or 25 and above or same?
How do i make sure there is no conflict of v7 appcompat when any app uses my library?
which version does the android take? Lower one or Higher one? How do i see it?
Gradle uses the higher one.
You can use the command gradlew dependencies to check the dependencies tree.
Won't there be any conflict if i use different version like 24 or 25 and above or same?
How do i make sure there is no conflict of v7 appcompat when any app uses my library?
In general the best way to maintain a library and to avoid the conflicts is to update the library always with the latest support libraries.
What if the compiledSDK of application is 23 with appcompat-v7:23.3.0 and and that of the library is 24 with appcompat-v7:24+. Which all support libraries does the android take?
If your library uses support libraries v24, the library and the app will require to be compiled with the same level = 24.
When I ran my app, it said that
Cannot Instant Run: legacy multi-dex on Dalvik runtime
Does it means that I can't use Instant Run when I use multi-dex?
I'm using Android Studio beta4.
In order to activate multiDex at old android versions you have to set multiDexEnabled to true, add dependency and extend your application class from MultiDexApplication or launch MultiDex.install(this) in your application class, which will cause legacy multiDex installation.
However since Intant Run can't work with legacy multiDex you have to use normal one. All you need is removing all that code above except of multiDexEnabled flag set to true. This method is only supported by devices with API 21 and above.
Feel free to correct me if something is wrong.
As mentioned in the documentation Instant Run is disabled by Android Studio in case multidex is enabled for API level 20 or lower and app is deployed on API level 20 or lower.
Documentation link
Just remove this line from your ProjectName/app/build.gradle
android {
defaultConfig {
multiDexEnabled true
}
}
remove multiDexEnabled true and you will able to instant run.