This is a Gradle error which I get when running the empty "hello world" (building from Empty Activity template) without any added code,
Here is the error:
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.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.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.0 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 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.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.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.0 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 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).
I will stop the error messages after these two as I suspect fixing one will fix all six.
Below is my build.gradle (:app)
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.enetapplications.empty"
minSdk 28
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
This error first occurred while building an app and I was only working with the xml and was ready to begin the java - then for testing I opened a blank "empty" project and received this exact same error thus seems something to do with how Android Studio is being configured.
Update your version to 33 as below
compileSdk 33
defaultConfig {
applicationId "com.enetapplications.empty"
minSdk 28
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Go to your build.gradle(:app), increase your compileSdk and targetSdk.
Write there:
compileSdk 33
targetSdk 33
Then at the top you will see 'Sync Now' Option, click on it. Now your problem has been resolved.
Related
I'm on ubuntu 16 android studio 2.3.3, device tablet 5.1. In my app I have these grandle file ....
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.bmeccoffice.remotehelp"
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
incremental false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'org.webrtc:google-webrtc:1.0.21217'
testCompile 'junit:junit:4.12'
}
I use an 5.1 device (tablet) and try to compile my symple app (actually only bottom navigation activity layout ... empty ... and nothing else) but I have a long list of 26 error during the Debug ....
Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are android.graphics.SurfaceTexture$OnFrameAvailableListener
Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.lang.RunnableError:Static method (these error 12 times)
org.webrtc.EglBase create() not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase create(org.webrtc.EglBase$Context sharedContext, int[] configAttributes) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase create(org.webrtc.EglBase$Context sharedContext) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase createEgl10(int[] configAttributes) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase createEgl10(javax.microedition.khronos.egl.EGLContext sharedContext, int[] configAttributes) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase createEgl14(android.opengl.EGLContext sharedContext, int[] configAttributes) not supported in Android API level less than 24
Error:Static method org.webrtc.EglBase createEgl14(int[] configAttributes) not supported in Android API level less than 24
Error:Execution failed for task ':app:transformClassesWithPreJackPackagedLibrariesForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.core.JackToolchain$ToolchainException: Jack compilation exception
I've just modified it (before support was for 1_7 version) .... but I have these error .... if return to old version with VERSION_1_7 && jackOptions == false ... obtain these 3 error:
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
Error:1 error; aborting
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex '/home/office/.android/build-cache/b4dd2b467a0ed596ad0e2a137856a6897964c81c/output/jars/classes.jar'
to '/home/office/AndroidStudioProjects/RemoteHelp2/app/build/intermediates /transforms/dex/debug/folders/1000/10 /classes_5110517f2feea04a1d9834af1ccaded1b5e9f0d5'
I have a module ... an external library .. but without dependancy ...
We need to use webrtc API.
some suggest how to solve these error?
EDIT:
remove the module ... nothing change ... same error.
previously I have posted the wrong solution .... change Gl performances (hardware or software) is not part of solutions.
the real solutions is:
sudo apt-get install lib64stdc++6
after these take advantage from new features I update Android Studio to version 3.0.1.
So the correct part of app->grandle.build is these:
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.bmeccoffice.remotehelp"
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
incremental false
}
}
thats all.
bkt
I try to move android TV app to Android studio. When I try to compile it, I had some import errors. I couldn't find the dependency that I can add to build.gradle to fix these problem. The list of the imports are:
import android.media.tv.TvContentRatingSystemInfo;
import android.media.tv.TvContract.WatchedPrograms;
import com.android.tv.tuner.data.nano.Track.AtscCaptionTrack;
import com.android.tv.tuner.data.nano.Track.AtscAudioTrack;
import com.android.tv.tuner.data.nano.Channel;
The build.gradle is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.android.tv"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk {
moduleName "libtunertvinput_jni"
}
}
sourceSets {
main {
res.srcDirs = ['src/main/res', 'src/main/usbtuner-res']
jni.srcDirs = []
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/exoplayer.jar')
compile project(':common')
compile 'com.android.support:palette-v7:+'
compile 'com.android.support:support-v4:+'
compile 'com.android.support:support-annotations:+'
}
You can't import these because they have #SystemApi annotation. You can check this for the source code of TvContentRatingSystemInfo. I have also checked WatchedPrograms and it also has #SystemApi annotation. I have not checked the other three.
You need to be system app to access these. As you can see here, you need to push your app in the the \system\ folder. You can find detailed information about AOSP build system here.
Solution :
Changing your android.jar to the .jar in this github should enable you to access system API. The reason is your standard android.jar doesn't have system API. So you need to get framework.jar (by adb pull) from emulator and combine it with core.jar then you can have new android.jar which contains system API (system methods and classes are available in the framework.jar from emulator).
Moreover, you should push your apk to \system\priv-app\ folder to access some system API but I don't know why I can access system API without pushing my apk to \system\priv-app\ when I use .jar from that github account.
I feel like I don't write quite clearly but at least now you have more understandings of what you're facing.
android.media.tv and com.android.tv are part of Android SDK. So you don't need to include any additional libraries in gradle.build file.
Just make sure to:
Update your SDK tools to version 24.0.0 or higher
and
Update your SDK with Android 5.0 (API 21) or higher
Example,
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.tvapp"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
}
use this in your dependencies "com.android.support:support-media-compat:26.0.2"
and also use tool version "26.0.1"
compiled SDK version 26.
You can add dependencies in app level gradle.
compile 'com.google.android.libraries.tv:companionlibrary:0.1'
With the following gradle script, I was wondering how to change the minSdkVersion from 7 to 3 (just so my app could run on more devices) without getting the error at the bottom of this post:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "dpark.cellular_automata"
minSdkVersion 3
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
}
... And then I would get the following error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 3 cannot be smaller than version 7 declared in library [com.android.support:appcompat-v7:23.0.1] C:\Users\Dave\AndroidStudioProjects\Cellular_Automata\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.1\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
... That said, is it even possible to lower my minimum SDK to 3 (version 1.5, Cupcake) if I wanted to publish my app with Google Play? And also, in case you're wondering, I also downloaded the Android Support Library in the SDK manager as follows, and yet it still doesn't work:
Thanks!
That error is telling you that one of your libraries (in this case, AppCompat) only supports back to SDK version 7. Since that library cannot support anything lower than 7 and you use that library, you can't support anything lower than 7.
Your options are either:
Remove AppCompat
Support a minimum of API level 7. Note that SDK version 8 currently has less than 0.1% of the market share globally, and all versions less than 8 have a combined total of 1%. It probably isn't worth your time.
That said, is it even possible to lower my minimum SDK to 3 (version 1.5, Cupcake) if I wanted to publish my app with Google Play?
Absolutely. You could upload an Android app supporting API level 1 if you really wanted to.
And also, in case you're wondering, I also downloaded the Android Support Library in the SDK manager as follows, and yet it still doesn't work:
The support library v4 only supports back to API level 4, so I'm not sure how that would help with supporting API level 3.
I build a player based VLC,and when I want to build a verson for Android 6.0,player can't start on Android 6.0 device.Here are the log:Can't load vlcjni library:java.lang.UnsatisfiedLinkError:dlopen failed:/data/app/lib/arm/libvlcjni.so: has text relocations.
And I have tried so many ways to solve it,but I haven't solve it yet.
I hope anyone can tell me about the problem.
Here is similar question and answers: libavcodec.so: has text relocations
Today, I got the same error messages when testing my app with Android 6.0 on a Nexus 6 (Motorola). I solved my issue by checking the targetSDKVersion in the manifest file. Using "22" and not "23" as targetSDKVersion solved it. (See below)
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="22" />
I also checked the build.gradle files for compile version and targetSDKversion:
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
}
Hope this will help you. However, this is just a short term workaround for now, I hope that we will get some feedback from metaio though.
Regards, christin
I only had to create a libs folder in my Android library, and then move the library files from the jniLibs folder to the libs folder. I believe this may have to do with the newer version of Gradle and build tools. That way, you don't have to downgrade your build tools/Gradle.
UPDATE:
I was able to build with the following build.gradle script for vlc-android. I needed the following updated versions. This allows me to build with SDK version 24, with build tools 24, and gradle version 2.2.0. See if this works for you.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'org.ajoberstar:gradle-git:1.3.2'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
//noinspection GradleCompatible
compile "com.android.support:support-v4:25.2.0"
compile 'com.android.support:support-annotations:25.2.0'
}
I just moved to new Ubuntu and, thus, installed the last java version which is 8 (or 1.8). I also installed Android Studio 0.5.7. However, Dalvik doesn't support Java 8, does it? I want to keep the current java 8 installed because I'm going to use it in Java projects but I also have to install Java 7 to be able to use it in Android. What's the right way to do this?
UPDATE:
The errors:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find any version that matches com.android.support:appcompat-v7:+.
Required by:
MyApplication:app:unspecified
#app/build.grandle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
error
Could not find any version that matches com.android.support:appcompat-v7:+.
is answered in Android Studio could not find any version that matches com.android.support:appcompat-v7:+
i.e in SDK Manager install/update Extras / Android Support Repository to use this dependency.