Whenever I try to build an APK for my project, this is the error I get:
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/json/simple/ItemList;
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "my.package.here"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'org.apache.clerezza.ext:org.json.simple:0.4'
compile 'com.android.support:design:23.2.0'
}
I think that means that more than one dependency defines ItemList. I know one is org.json.simple, what is the other one?
How do I properly exclude ItemList from one of them?
there's nothing in my libs folder so that's not the problem
replace this compile 'org.apache.clerezza.ext:org.json.simple:0.4'
with
compile('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
the source is here: click link
Related
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "testing.gps_service"
minSdkVersion 11
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'dev.dworks.libs:volleyplus:+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories
{
mavenCentral()
google()
}
apply plugin: 'kotlin-android-extensions'
-------------------------------------------------------
## I'm new to Android, currently working on FYP, as I run my project, an
error is occurred.##
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Compile with
compile 'dev.dworks.libs:volleyplus:0.1.4'
hope that will help
Use this Link for Upload Image "https://www.simplifiedcoding.net/android-upload-image-to-server/"
Cannot authenticate with Google on Android. Android Studio shows these errors:
The following classes could not be instantiated:
com.google.android.gms.common.SignInButton
Here is my XML
<com.google.android.gms.common.SignInButton
android:id="#+id/sign_in_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
and here is my app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.ramadanapp.android.firebaseuploadimage"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.google.firebase:firebase-storage:11.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-auth:11.4.0'
compile 'com.google.android.gms:play-services-auth:11.4.0'
}
apply plugin: 'com.google.gms.google-services'
Have you added dependency in build.gradle file at project level? If not then add the below dependency in that.
dependencies{
classpath 'com.google.gms:google-services:3.0.0'
...
}
i think you didn't add the dependencies of play-services-auth
Just add compile 'com.google.android.gms:play-services-auth:11.4.0' dependencies in build.gradle app file like below code
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services-auth:11.4.0'
}
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Please I'd like to know how I can fix that problem.
It happens when I tried to build signed apk.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "xxxxxxx"
manifestPlaceholders = [manifestApplicationId: "${applicationId}",
onesignal_app_id: xxxxxxxx",
onesignal_google_project_number: "xxxxxx"]
minSdkVersion 16
targetSdkVersion 23
versionCode 2
versionName "2.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.onesignal:OneSignal:3.+#aar'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.google.android.gms:play-services-analytics:9.8.0'
compile "com.google.android.gms:play-services-location:9.8.0"
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-invites:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
Add your android closure in your build.gradle file
dexOptions {
javaMaxHeapSize "4g"
}
Also refer below mentined solution link Extremely long build with Gradle
here is my code of build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.shadibazzar.delhibookstore"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
classpath 'com.google.gms:google-services:3.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile project(":volley")
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
Error:(28, 0) Gradle DSL method not found: 'compile()'
Possible causes:
The project 'Delhi Book Store' may be using a version of Gradle that
does not contain the method.
The build file may be missing a Gradle plugin.
when i create new project on android studio i receive error :
and this is the code when i click on show in project :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "org.ashiyane.sepehr"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
}
Just comment that line in build.gradle file..
//testCompile 'junit:junit:4.12'
Check your module Dependencies :
Android Studio > File > Project Structure > Select your Module >Dependencies > + > Library Dependency > check it available or not otherwise update your repository in SDK