Gradle error while Importing project from eclipse to studio - android-studio

i am trying to importing my eclipse project to Android studio.SO i removed all my GCM code and create code for FCM. But when i creating Build APK it shows me following error like
Error:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
My gradle file contains following dependencies and libraries.
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "mi.nashik.online"
minSdkVersion 15
targetSdkVersion 23
versionCode 16
versionName "1.9.6"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile ('com.android.support:appcompat-v7:23.4.0')
{
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'com.android.support'
exclude group: 'com.android.support', module: 'support-v4'
}
compile ('com.google.android.gms:play-services:9.0.2'){
exclude group: 'com.android.support'
exclude group: 'com.google.guava'
}
compile 'com.google.code.gson:gson:2.1'
compile 'com.google.protobuf:protobuf-java:2.2.0'
compile files('libs/google-api-client-1.10.3-beta.jar')
compile files('libs/google-api-client-android2-1.10.3-beta.jar')
compile files('libs/google-http-client-1.10.3-beta.jar')
compile files('libs/google-http-client-android2-1.10.3-beta.jar')
compile files('libs/google-oauth-client-1.10.1-beta.jar')
compile files('libs/jackson-core-asl-1.9.4.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/library-1.2.2.jar')
compile 'com.squareup.picasso:picasso:2.5.0'
compile files('libs/slider.jar')
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.firebase:firebase-analytics:9.0.2'
compile ('com.google.firebase:firebase-core:9.0.2')
{
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile ('com.google.firebase:firebase-messaging:9.0.2'){
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile files('libs/universal-image-loader-1.9.3-SNAPSHOT.jar')
compile files('libs/urlimageviewhelper-1.0.4.jar')
}
apply plugin: 'com.google.gms.google-services'

Update your gradle.properties file by
org.gradle.jvmargs=-Xms256m -Xmx1024m

Related

Migrating to the New Places SDK Client

When I add in my gradle dependencies implementation 'com.google.android.libraries.places: places: 1.0.0'
I continue with the error: Java Compiler error: cannot access Hide
org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
Here is my list of dependencies:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 26
buildToolsVersion '26.0.3'
defaultConfig {
applicationId 'com.test.pass'
minSdkVersion 17
targetSdkVersion 26
versionCode 13
versionName '1.0.3'
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
dexOptions {
javaMaxHeapSize '4g'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
allprojects {
repositories {
mavenCentral()
}
}
dependencies {
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
}
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'
exclude group: 'com.google.code.findbugs'
})
compile('com.mikepenz:fastadapter:2.0.0#aar') {
transitive = true
}
compile 'com.afollestad.material-dialogs:core:0.9.0.0'
compile 'com.mikepenz:iconics-core:2.8.1#aar'
compile 'com.mikepenz:fontawesome-typeface:4.6.0.2#aar'
compile('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
exclude module: 'support-v4'
}
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.guava:guava:19.0'
compile 'com.dmitrymalkovich.android:material-design-dimens:1.4'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1#aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1#aar'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'me.relex:circleindicator:1.2.2#aar'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.firebase:firebase-messaging:12.0.1'
compile 'com.mobsandgeeks:android-saripaar:2.0.3'
compile 'com.google.android.gms:play-services:12.0.1'
compile 'org.greenrobot:eventbus:3.1.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.github.siyamed:android-shape-imageview:0.9.3'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.balysv:material-ripple:1.0.2'
}
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
dependencies {
implementation 'com.google.android.libraries.places:places:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
and here is my project level gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.realm:realm-gradle-plugin:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
// maven {
// url 'https://maven.google.com/'
// name 'Google'
// }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add this in your app gradle file under dependencies:
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
this is not my solution, I got it from other guy from SO, but can't find that question. I will add the link to that post later.
Edited: Original Answer

Android support libraries - diff versions

An error crept into my project last night, somehow between builds. I didn't change anything, other than a bit of code, and it went from working to not, with this error - source code does not match the bytecode.
That led to a round of updating everything (gradle etc). Now a different error is occurring.
The error is;
All com.android.support libraries must use the exact same version specification. Found versions 25.2.0, 24.2.1. Examples include com.android.support:support-compat:25.2.0.
Here's a copy of my build.gradle;
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '27.0.1'
defaultConfig {
applicationId "au.com.me.myproject"
minSdkVersion 24
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'
}
}
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:24.2.1'
//compile 'com.android.support:support-media-compat:24.2.1'
//compile 'com.android.support:support-v4:24.2.1'
//compile 'com.android.support:support-compat:24.2.1'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-appindexing:11.6.2'
compile 'org.greenrobot:eventbus:3.1.1'
}
I can't work out where the support-compat:25.2 dependency is coming from. I've done a clean>rebuild.
Any idea how to fix this? thanks all :)
UPDATE
Gradle View shows that com.google.firebase:firebase-appindexing:11.6.2 has a dependency on com.google.android.gms:play-services-basement:11.6.2, which in turn has a com.android.support:support-v4:25.2.0 dependency. (assuming I'm reading it correctly).

Android studio APK buil error transformClassesWithJarMergingForDebug

I'm trying to build APK, but there is an error when I try to make it.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/gcm/PendingCallback.class
Following is my build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "jordan.personicle"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
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 files('libs/ajt-2.9.jar', 'libs/javaml-0.1.7.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services:11.0.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile 'org.jsoup:jsoup:1.7.3'
compile 'com.android.support:multidex:1.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
This is my build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.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
}
I think there is no duplication for gcm. What is the problem?
Thanks,
Make sure you use the same version in all your google play services libs:
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
See https://stackoverflow.com/a/42610163/1370087

Create APK file of automation script using Android Studio

after put appium 'java-client' dependencies in android studio not build .apk what i do please tell me
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
dexOptions {
incremental true
jumboMode = true
// preDexLibraries = false
}
defaultConfig {
applicationId "com.example.ignatiuz.photoboothapplication"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
repositories {
jcenter()
mavenCentral()
}
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 'io.appium:java-client:3.4.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'commons-logging:commons-logging:1.2'
// compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
compile 'org.apache.httpcomponents:httpcore:4.4.6'
testCompile 'junit:junit:4.12'
compile files('libs/commons-logging-1.2.jar')
compile files('libs/httpclient-4.5.3.jar')
compile files('libs/httpcore-4.4.6.jar')
}
and my jar detail
and my error
Error Text
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: net/sf/cglib/beans/BeanCopier$BeanCopierKey.class
You can use gradle to import all the dependencies that you need instead of adding them in /libs folder
These are the dependencies I'm having in build.gradle for connecting and running Appium tests.
compile 'junit:junit:4.12'
compile 'io.appium:java-client:4.1.2'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'org.apache.httpcomponents:httpclient:4.5.1'
compile 'commons-lang:commons-lang:2.6'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.http-client:google-http-client:1.21.0'
compile 'com.testdroid:testdroid-api:2.9'
compile 'com.google.http-client:google-http-client-jackson2:1.21.0'

java.util.zip.ZipException: duplicate entry: javax/annotation/CheckForNull.class

I migrated my project from eclipse to Android Studio,When I'm trying to run my app,I am getting following issue
':transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/annotation/CheckForNull.class
Here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.le.SampleApp"
minSdkVersion 11
targetSdkVersion 23
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
aaptOptions
{
cruncherEnabled = false
}
useLibrary 'org.apache.http.legacy'
}
configurations {
compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}
dependencies {
compile project(':_library')
compile project(':drag_library')
compile project(':library_pull')
compile 'com.android.support:support-v4:23.+'
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile 'com.google.code.gson:gson:2.1'
compile 'com.google.guava:guava:18.0'
compile 'joda-time:joda-time:2.2'
compile 'com.android.support:appcompat-v7:23.+'
compile files('libs/google-http-client-1.13.1-beta.jar')
compile files('libs/google-http-client-android-1.15.0-rc.jar')
compile files('libs/google-play-services.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/amazinglistview.jar')
compile files('libs/android-viewbadger.jar')
compile files('libs/commons-io-1.3.2.jar')
compile files('libs/commons-lang3-3.1.jar')
compile files('libs/crashlytics.jar')
compile files('libs/d2xx.jar')
compile files('libs/iHealthLibrary_2.2.8.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/paho-mqtt-client-1.0.1.jar')
compile files('libs/pl2303driver.jar')
compile files('libs/robospice-1.4.11.jar')
compile files('libs/robospice-cache-1.4.11.jar')
compile files('libs/robospice-google-http-client-1.4.11.jar')
compile files('libs/rtcc-5.4.730.jar')
compile files('libs/samsung_ble_sdk_200.jar')
compile files('libs/universal-image-loader-1.9.3-with-sources.jar')
compile files('libs/volley.jar')
}
Any advice on how i could resolve this issue?

Resources