I were trying to use the Selenium WebDriver for an Android application. (I am using the latest AndroidStudio; v2.2)
I followed this guide so in the lib's my app I copied the jar files (the downloaded zip of Selenium WebDriver has a folder named "libs", a jar named "client-combined-3.0.0-beta4-nodeps" and a DEPENDENCIES and a LICENSE file[I've just copied all the jars in the "libs" folder and the other jar outside])
Here's the build.gradle (module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.example.utente.downall"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
pickFirst("META-INF/LICENSE")
pickFirst("META-INF/DEPENDENCIES")
}
}
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:24.2.1'
testCompile 'junit:junit:4.12'
compile files('libs/cglib-nodep-3.2.4.jar')
compile files('libs/client-combined-3.0.0-beta4-nodeps.jar')
compile files('libs/commons-codec-1.10.jar')
compile files('libs/commons-exec-1.3.jar')
compile files('libs/commons-logging-1.2.jar')
compile files('libs/gson-2.3.1.jar')
compile files('libs/guava-19.0.jar')
compile files('libs/hamcrest-core-1.3.jar')
compile files('libs/hamcrest-library-1.3.jar')
compile files('libs/httpclient-4.5.2.jar')
compile files('libs/httpcore-4.4.4.jar')
compile files('libs/httpmime-4.5.2.jar')
compile files('libs/jna-4.1.0.jar')
compile files('libs/jna-platform-4.1.0.jar')
compile files('libs/junit-4.12.jar')
compile files('libs/netty-3.5.7.Final.jar')
compile files('libs/phantomjsdriver-1.3.0.jar')
}
(Project synched)
While executing "run" I had this 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: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
So I've gone to the build.gradle (Project: DownAll) and I added these target/source compatibility, so here's what's like:
I cleaned the project, rebuilded it, re-synched it but still the same error.
What should I do?
If it can help, here's my environment variables, if it can help:
JAVA_HOME
C:\Program Files\Java\jdk1.8.0_102
ANDROID_HOME
C:\Users\Utente\AppData\Local\Android\sdk;C:\Users\Utente\AppData\Local\Android\sdk\tools;C:\Users\Utente\AppData\Local\Android\sdk\platform-tools
(AppData folder is hidden)
EDIT:
UP
I just faced the exact same error and figured out that com.google.guava:guava:21.0 was causing the problem; app starts working right after downgrading it to 20.0.
So, I guess some of your jars might be incompatible.
Try downgrading / removing dependencies one by one.
Related
please how can I solve this error ?
ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin
version 1.3.0 and higher. The following dependencies do not satisfy
the required version: root project 'android' ->
org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.6 Affected Modules:
android-app
WARNING: Configuration 'compile' is obsolete and has been replaced
with 'implementation' and 'api'. It will be removed at the end of
2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: android-app
WARNING: Configuration 'testCompile' is obsolete and has been replaced
with 'testImplementation'. It will be removed at the end of 2018. For
more information see:
http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: android-app
WARNING: Configuration 'androidTestCompile' is obsolete and has been
replaced with 'androidTestImplementation'. It will be removed at the
end of 2018. For more information see:
http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: android-app
WARNING: The specified Android SDK Build Tools version (26.0.2) is
ignored, as it is below the minimum supported version (28.0.3) for
Android Gradle Plugin 3.3.1. Android SDK Build Tools 28.0.3 will be
used. To suppress this warning, remove "buildToolsVersion '26.0.2'"
from your build.gradle file, as each version of the Android Gradle
Plugin now has a default version of the build tools. Remove Build
Tools version and sync project Affected Modules: android-app
my android-app file :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "fr.curie.jonquille.jonquille_curie"
minSdkVersion 18
targetSdkVersion 26
versionCode 203000
versionName "2.3.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
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 "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.android.support:design:26.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.2.4'
compile 'io.reactivex:rxkotlin:0.60.0'
compile 'com.jakewharton.rxbinding:rxbinding-kotlin:1.0.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4-kotlin:1.0.0'
compile 'com.jakewharton.rxbinding:rxbinding-appcompat-v7-kotlin:1.0.0'
compile 'com.jakewharton.rxbinding:rxbinding-design-kotlin:1.0.0'
compile 'com.jakewharton.rxbinding:rxbinding-recyclerview-v7-kotlin:1.0.0'
compile 'com.tbruyelle.rxpermissions:rxpermissions:0.9.1#aar'
compile 'pl.charmas.android:android-reactive-location:0.10#aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.sdoward:rxgooglemaps:1.1.1#aar'
compile 'com.github.kittinunf.fuel:fuel:1.3.1'
compile 'com.github.kittinunf.fuel:fuel-android:1.3.1'
compile 'com.github.kittinunf.fuel:fuel-rxjava:1.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-wallet:10.0.1'
compile 'com.stripe:stripe-android:2.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.twitter.sdk.android:twitter-core:3.1.1'
compile 'com.twitter.sdk.android:tweet-composer:3.1.1'
testCompile 'junit:junit:4.12'
}
repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
my android file :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.0.6'
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The error is caused by the old version of Kotlin in your project level file, you can update it to the latest version like so:
ext.kotlin_version = '1.3.21'
As for your warnings:
You should remove the explicit build tools version (buildToolsVersion "26.0.2") from your module level file, as the new Android Gradle plugins already pick the correct build tools to use automatically.
You should check out the link in the warnings and update your dependency configuration, e.g. replace compile with implementation or api, and so on.
I have a very strange error. I use android studio 2.3.
First of all please watch my gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "com.example.name.webrtcwork"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
sourceSets.main {
jniLibs.srcDir 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.myhexaville:smart-image-picker:1.0.4'
compile 'pub.devrel:easypermissions:1.1.3'
compile('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile files('libs/autobanh.jar')
compile files('libs/base_java.jar')
compile files('libs/libjingle_peerconnection.jar')
testCompile 'junit:junit:4.12'
}
Project clean and rebuild works successfully, but if I want to run the app, I'm getting error like this.
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 '/Users/Hayk.Mkrtchyan/.android/build-cache/7fd66238e8a360302161a82746a2b9f0a8b83132/output/jars/classes.jar' to '/Users/Hayk.Mkrtchyan/Desktop/WebRTCWork/app/build/intermediates/pre-dexed/debug/classes_547e5465c50bca12a58d5755bafa9d6a10538b52.jar'
Ok I tried many ways to solve the issues like adding targetCompatibility = '1.7'
sourceCompatibility = '1.7' in my build file. This not works.
I don't want to add version 1.8 and I don't want to upgrade my android studio version to 3.0. How can I solve this?
And If I'll add the version 1.8 and will enable the jack, it gives error too like.
Error:Execution failed for task ':app:transformClassesWithPreJackPackagedLibrariesForDebug'.
Cannot load Jill from build tools.
How can I fix this?
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.
FYI
All com.android.support: version should be same.
Android Studio 3.0 and later supports all Java 7 language features and a subset of Java 8 language features that vary by platform version.
You can also configure it directly in the corresponding build.gradle file:
android {
...
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Read Use Java 8 language features.
Thanks everyone for answer. The problem was that this library (compile 'com.myhexaville:smart-image-picker:1.0.4') gave conflict. When I removed it everything worked finally.
This question already has answers here:
Failed to resolve: com.android.support:appcompat-v7:26.0.0
(14 answers)
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
(26 answers)
Closed 5 years ago.
Everything has been working and compiling fine until I've added a TabLayout to an .xml layout. After I added it, the project just refused to compile and either all of my .xml files stopped showing anything and all of my library imports say "cannot resolve symbol ...".
I don't understand why all of my imports which had previously been compiling well now simply say:
Failed to resolve: com.android.support:support-v13:26
Failed to resolve: com.android.support:appcompat-v7:26
and none of buttons provided (e.g. "Install repository and sync project") are clickable.
Please, have a look at the gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.prett.myapplication"
minSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
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:support-v13:26'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
}
I've tried "Invalidate caches/restart", but it didn't have any impact.
P.S.
compile 'com.android.support:design:25.3.1'
says that
This support library should not use a different version (25) than the compileSdkVersion (26)
Could this also be causing the issue?
If your compile SDK version is 26, android support dependencies version should be 26.x.x
Set your gradle dependencies as follow:
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.0.1'
compile 'com.android.support:support-v13:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.0.1'
}
If you still get compile errors, add google maven repository to Project Gradle file:
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}
Try below dependency in gradle and rebuild project;
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:support-v13:26.0.1'
compile 'com.android.support:design:26.0.1'
This support library should not use a different version (25) than the compileSdkVersion (26)
means you have to update your support library from version 25 to 26 and problem will get resolved.
I have just installed new Android Studio and tried to create a new project. But I get this strange error. I am using 32 bit Linux system.
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: AAPT process not ready to receive commands
Information:BUILD FAILED
Error:java.util.concurrent.ExecutionException: java.lang.RuntimeException: AAPT process not ready to receive commands
Information:Total time: 14.838 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
I don't understand why I am getting this error.
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.sandesh.testing"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Gradle (project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In your case problem is newest Android Studio does not run on 32bit only system. On download page you can check the requirement also:
64-bit distribution capable of running 32-bit applications
The newest version does not support 32bit. I think you should try with one solution but I dont know how long it will work :
Step1.Go to terminal
Step2.type gedit .profile
Step3.paste the below line at end of the page
Step4.export ANDROID_EMULATOR_FORCE_32BIT=true
Step5.type source .profile in terminal or restart system
Please remember that may be in future Android Stdio stop supporting this too so its better you should move to bit64 or downgrade your version of android studio.
I have an issue with Parse. I had the sdk (downloaded on Parse.com and unzip inside /libs folder in my project) and when I build everything is good.
But when I run the app,I have this following error :
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 2
I don't know what to do, I search and tried everything I found on StackOverflow and github repo of Parse but nothing works :/
Any idea ?
Thanks in advance for your answer.
Simple in your gradle file add these ...
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
// add dexOptions
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
provided fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.parse:parse-android:1.11.0'
// add multidex dependency
compile 'com.android.support:multidex:1.0.1'
}
reference: Error:Execution failed for task ':app:dexDebug' error in my project while I added new dependency
Try to clean your project (Build -> Clean Project) or try to add this:
defaultConfig {
multiDexEnabled true
}
to your build.gradle file
Try to add the following code to your build.gradle (module: app)
dependencies{
...
...
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}
and no need of adding multiDex.
Hope this should work.