Following on from another question, which is resolved.
I'm following through the Start Developing for Android course in Pluralsight. We're just about to add tests. The instructions say to add add androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' to the build.gradle file (the one in the app module).
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
defaultConfig {
applicationId 'com.sqisland.android.hello'
minSdkVersion 1
targetSdkVersion 24
versionCode 1
versionName '1.0.0'
}
dependencies {
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
}
}
When I sync the build I can an error though:
Error:Execution failed for task ':app:processDebugAndroidTestManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 8 declared in library [com.android.support.test.espresso:espresso-core:2.2.2] F:\BanksySan\Development\PluralSight\android-hello-world\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.test.espresso" to force usage
Should I use the suggested fix? At the moment I'm thinking that's it's more likely that I'm missing a library somewhere.
After Andy's suggestion below
I've moved the block outside, the error is:
Error:Execution failed for task ':app:processDebugAndroidTestManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 8 declared in library [com.android.support.test.espresso:espresso-core:2.2.2] F:\BanksySan\Development\PluralSight\android-hello-world\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.test.espresso" to force usage
Move the dependencies block out of android block and raise your minSdkVersion to at least 8:
android {
minSdkVersion: 8
//...
}
dependencies {
// ....
}
Related
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.
I'm running android studio on 32 bit ubuntu 16.04, and I'm trying to run my application.
When I run gradlew it works fine for me, but when I'm ready to build the apk and run it on my device, it shows my everytime:
My gradle (app) file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath(
'com.android.tools.build:gradle:2.3.3',
"com.neenbedankt.gradle.plugins:android-apt:1.8",
)
}
}
apply plugin: "com.android.application"
apply plugin: "com.neenbedankt.android-apt"
repositories {
jcenter()
}
android {
compileSdkVersion 17
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.clarifai.android.starter.api.v2"
minSdkVersion 15
targetSdkVersion 17
versionCode 2
versionName "1.1"
}
lintOptions { lintConfig rootProject.file('gradle/lint.xml') } // needed to suppress Okio's lint errors
}
dependencies {
compile(
"com.android.support:appcompat-v7:24.2.1",
"com.android.support:recyclerview-v7:24.2.1",
"com.android.support:design:24.2.1",
"com.clarifai.clarifai-api2:core:2.2.+",
// For logging our HTTP outbound + inbound data
"com.jakewharton.timber:timber:4.3.0",
"com.squareup.okhttp3:logging-interceptor:3.4.1",
// For runtime permissions on Marshmallow and above
"io.reactivex:rxjava:1.1.10",
"com.tbruyelle.rxpermissions:rxpermissions:0.7.1#aar",
)
compile('com.mikepenz:materialdrawer:5.6.0') { transitive = true }
// For getting views without clunky findViewById
compile 'com.jakewharton:butterknife:8.4.0'
apt "com.jakewharton:butterknife-compiler:8.4.0"
}
(sorry for the bad indents)
Please help me understand what the problem is.
I was trying all the suggestions in the net so far to my problem, but none helped.
I imported my project from Eclipse to to Android Studio. When I built project I take error message below:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:11.0.0] C:\Users\Ahmet\Documents\edx\Android\WonderkidandTransfersforFM17\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\11.0.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage
I tried change minsdk version and I tried add tools:overrideLibrary="com.google.android.gms.play_services" in manifest. I can't solve this problem.
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ahmety.wonderkidandtransfersforfm17"
android:versionCode="24"
android:versionName="1.3" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.ahmety.wonderkidandtransfersforfm17"
minSdkVersion 10
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.android.gms:play-services:+'
compile files('libs/OneSignalSDK.jar')
}
You do not need a Jar file for OneSignal.
compile 'com.onesignal:OneSignal:3.5.7'
And never use a + as a version or compile all the Google Play Services
compile 'com.google.android.gms:play-services:+'
Please choose only those that you actually need.
https://developers.google.com/android/guides/setup#split
For example,
compile 'com.google.android.gms:play-services-ads:11.0.0'
Regarding the error, you need to change android:minSdkVersion="10" to be version 14, as it says.
You need to change the "minSdkVersion" from 10 to 14 in both "manifest" and "build.gradle". Otherwise you need to downgrade the version of "Google Play Services" library, I won't recommend that. I'll suggest you to just change the "minSdkVersion" from 10 to 14. I won't make difference to your app because I don't think people are still using Android devices of version 10.
Sync your project after changing the "minSdkVersion".
You are using a library which requires your minSdkVersion in the manifest to be at least 14. What you need to do is to set the minSdkVersion to 14 or more.
Currently I am using java 8 with latest android studio 2.1
Here is my build.gradle file
android {
compileSdkVersion 22
buildToolsVersion "24rc3"
defaultConfig {
applicationId "com.name"
minSdkVersion 10
targetSdkVersion 19
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
.......
}
I am getting the below compile time error that I have no clue
Error:com.android.jack.frontend.FrontendCompilationException: Failed
to compile at com.android.jack.Jack.buildSession(Jack.java:892) at
com.android.jack.Jack.run(Jack.java:472) at
com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:102)
... 8 more Warning:Exception while processing task
java.io.IOException: com.android.jack.api.v01.CompilationException:
Failed to compile :oTT:compileDebugJavaWithJack FAILED Error:Execution
failed for task ':oTT:compileDebugJavaWithJack'.
java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile Information:BUILD FAILED
Please feel to ask if you need some details.
I had this error too, and what I found was that the error itself was masking another compilation issue. Look at your Console Messages carefully and see if there is something else not compiling. Once I solved the underlying issue with my own code, this error magically disappeared. Hope this helps.
Try to use next values:
compileSdkVersion = "android-N"
buildToolsVersion = "24.0.0 rc3"
you can try
compileSdkVersion 23
buildToolsVersion '24.0.0-rc3'
note the dash before rc3. This is according to http://developer.android.com/preview/setup-sdk.html under the section "Update an existing project"
I am using 23 just for the lambda.
the following link shows the Supported Java 8 Language Features and APIs https://developer.android.com/preview/j8-jack.html
I think we are all looking mostly at the same answer. To be precise I'd say "make sure the buildToolsVersion = "[version]" is the same as the [version] in the error".
For some this will be 24.0.0
Some java 8 features only support Android N. read android docs
http://developer.android.com/preview/j8-jack.html#configuration
When I use Default Methods on sdk23, I got this error too. so update your sdk version to Android N.
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'
}