FATAL EXCEPTION: IntentService[GcmIntentService] [duplicate] - java

I updated playservice in my sdk and I got this error. And I am not able to access GCM Token. Before update sdk my project work perfectly.
I waste my whole day in it but not found any solution. I tried this but gettting error in this dependencies com.google.android.gms:play-services-plus:9.0.0
Here is my logcat
Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.android.gms.iid.zzd' (declaration of 'com.google.android.gms.iid.zzd' appears in /data/data/com.hwindiapp.passenger/files/instant-run/dex/slice-com.google.android.gms-play-services-iid-9.0.0_b51865a18dbfbfb3651aaa54856c955adf1e354f-classes.dex)
at com.google.android.gms.iid.zzd.zzeC(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.processGCMID_user(RegisterFbLoginResCallBack.java:166)
at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.doInBackground(RegisterFbLoginResCallBack.java:219)
at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.doInBackground(RegisterFbLoginResCallBack.java:153)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:818) 
12-01 12:23:59.553 18157-18703/com.hwindiapp.passenger E/ACRA: Not adding buildConfig to log. Class Not found : com.VolleyLibFiles.BuildConfig. Please configure 'buildConfigClass' in your ACRA config
12-01 12:24:00.013 18157-19059/com.hwindiapp.passenger E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
Process: com.hwindiapp.passenger, PID: 18157
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.android.gms.iid.zzd' (declaration of 'com.google.android.gms.iid.zzd' appears in /data/data/com.hwindiapp.passenger/files/instant-run/dex/slice-com.google.android.gms-play-services-iid-9.0.0_b51865a18dbfbfb3651aaa54856c955adf1e354f-classes.dex)
at com.google.android.gms.iid.zzd.zzeC(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.processGCMID_user(RegisterFbLoginResCallBack.java:166)
at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.doInBackground(RegisterFbLoginResCallBack.java:219)
at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.doInBackground(RegisterFbLoginResCallBack.java:153)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
Showing error in this line of code
InstanceID instanceID = InstanceID.getInstance(mContext);
GCMregistrationId = instanceID.getToken(CommonUtilities.SENDER_ID, GoogleCloudMessaging.INSTANCE_ID_SCOPE,
null);
And here is my gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'hwindi'
keyPassword '123456'
storeFile file('D:/Company Projects/Hwindi/Project 2/Play_KeyStore/HwindiKeyStore.jks')
storePassword '123456'
}
}
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.hwindiapp.passenger"
minSdkVersion 16
targetSdkVersion 24
versionCode 12
versionName "1.12"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'lib/arm64-v8a/libcardioDecider.so'
exclude 'lib/arm64-v8a/libcardioRecognizer.so'
exclude 'lib/arm64-v8a/libcardioRecognizer_tegra2.so'
exclude 'lib/arm64-v8a/libopencv_core.so'
exclude 'lib/arm64-v8a/libopencv_imgproc.so'
exclude 'lib/armeabi/libcardioDecider.so'
exclude 'lib/armeabi-v7a/libcardioDecider.so'
exclude 'lib/armeabi-v7a/libcardioRecognizer.so'
exclude 'lib/armeabi-v7a/libcardioRecognizer_tegra2.so'
exclude 'lib/armeabi-v7a/libopencv_core.so'
exclude 'lib/armeabi-v7a/libopencv_imgproc.so'
exclude 'lib/mips/libcardioDecider.so'
exclude 'lib/x86/libcardioDecider.so'
exclude 'lib/x86/libcardioRecognizer.so'
exclude 'lib/x86/libcardioRecognizer_tegra2.so'
exclude 'lib/x86/libopencv_core.so'
exclude 'lib/x86/libopencv_imgproc.so'
exclude 'lib/x86_64/libcardioDecider.so'
exclude 'lib/x86_64/libcardioRecognizer.so'
exclude 'lib/x86_64/libcardioRecognizer_tegra2.so'
exclude 'lib/x86_64/libopencv_core.so'
exclude 'lib/x86_64/libopencv_imgproc.so'
}
configurations.all {
/*resolutionStrategy {
force 'com.android.support:design:23.4.0'
force 'com.android.support:support-v4:23.4.0'
force 'com.android.support:appcompat-v7:23.4.0'
}*/
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile ('com.squareup:fest-android:1.0.8') {
exclude module: 'support-v4'
}
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.android.gms:play-services-location:9.0.0'
compile 'com.google.android.gms:play-services-maps:9.0.0'
compile 'com.google.android.gms:play-services-plus:9.0.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.paypal.sdk:paypal-android-sdk:2.13.3'
compile 'com.wdullaer:materialdatetimepicker:2.2.0'
compile 'com.mukesh:permissions:1.0.3'
}

Please check your declared dependencies. As discussed in the given documentation there are three different types of direct dependencies in the app/ module's build.gradle file.
Sample dependencies are as follows:
android {...}
...
dependencies {
// The 'compile' configuration tells Gradle to add the dependency to the
// compilation classpath and include it in the final package.
// Dependency on the "mylibrary" module from this project
compile project(":mylibrary")
// Remote binary dependency
compile 'com.android.support:appcompat-v7:25.0.1'
// Local binary dependency
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Furthermore, as answered by #Diego Giorgini in a related SO post,
The issue you are experiencing is due to an incompatibility between
play-services / firebase sdk v9.0.0 and com.android.support:appcompat-v7 >= 24 (the version released with android-N sdk)
With this, you may want to try the suggested fix:
You should be able to fix it by targeting an earlier version of the support library. Like:
compile 'com.android.support:appcompat-v7:23.4.0'
You may want to also check the other suggestions in the following SO posts:
IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM
Android Google Cloud Messaging (GCM) token generation crash after Firebase-related Google Play Services update.

I had the same problem after some digging I found out that facebook sdk was depending on the new version of google support libraries than I have compiled on.
You can check the dependencies with gradle command
./gradlew app:dependencies
Ensure that all the dependency libraries has same version.
If not then you can exclude that dependency using
compile ('com.facebook.android:facebook-android-sdk:[4,5)'){
exclude module: 'support-v4'
exclude group: 'com.android.support'
}
then later add the required the dependency you have compiled your project on, In my case
compile 'com.android.support:support-v4:23.1.0'

Set a API version check of > 22 cause I got the same issue
java.lang.IllegalAccessError: Method 'void android.widget.ProgressBar.setProgress(int, boolean)' is inaccessible to class
and I fixed it like:
if (Build.VERSION.SDK_INT > 22)
progressBar.setProgress(currentProgress, true);
else
progressBar.setProgress(currentProgress);
check here setProgress Issue

I have Android Studio 2.3 and my problem was solved by uninstalling the "Android Support Library (Obsolete)" from SDK Tools.

Related

Millennial Media SDK 6.4 integration in Android fails

I'm trying to integrate Millennial Media SDK 6.4 in my Android app, but it shows an error message below when I run the app on my phone.
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$1.class
At first, I run the sample code with latest SDK downloaded directly from Millennial Media site, and it worked perfectly on my device. Then I migrated the inline ad code into my app following the official integration guide and there were no any problems when compiling or cleaning the project until I attempted running it in my phone. Please see my build.gradle file below.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId '<My Application ID>'
minSdkVersion 16
targetSdkVersion 25
versionName '1.0'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
versionCode 5
versionNameSuffix '5'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding.enabled = true;
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:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:preference-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile project(':android-ad-sdk')
compile 'com.google.android.gms:play-services:10.2.4'
}
I have tried cleaning gradlew, updating the gradle version and restarting the project, but nothing works. I have also contacted Millennial Media support team a day ago, though no response has been heard yet.
Have anyone seen this problem or known how to fix. Please give me any advices that I will appreciate. Or do you use other ad network providers that could be better than Millennial Media?
Cheers.
Update 1:
I've tried commenting compile "com.google.android.gms:play-services:10.2.4". Although it built the app, it showed a fatal exception below when I started the activity with the ad.
E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
java.lang.NoClassDefFoundError: com.google.android.gms.common.GoogleApiAvailability
at com.millennialmedia.internal.utils.EnvironmentUtils.getAdInfo(EnvironmentUtils.java:356)
at com.millennialmedia.internal.utils.EnvironmentUtils$1.run(EnvironmentUtils.java:132)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)

FireBase Error: cannot access zzanb class file for com.google.android.gms.internal.zzanb not found

UPD. I have read these question and answer (Class file for com.google.android.gms.internal.zzaja not found). But I doesnt understand what strings i need to add or remove in my project.
Because I havent this and other strings in my code:
compile 'com.google.android.gms:play-services-location:9.2.0'
I develop an android app with use of FireBase. And when I want to build my project I have an error:
Error:(39, 25) error: cannot access zzanb
class file for com.google.android.gms.internal.zzanb not found
The error was caused by invoking statement: FirebaseAuth.getInstance().getCurrentUser();
Projects build.gradle:
// 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.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Modules build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "xxx.yyy.zzz"
minSdkVersion 19
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(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.google.firebase:firebase-core:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.1.0'
compile 'com.firebaseui:firebase-ui:0.6.0'
compile 'com.android.support.test.espresso:espresso-core:2.2.2'
}
apply plugin: 'com.google.gms.google-services'
Please, help me to solve that error)
P.S I have already read that question (Firebase Error cannot access zzanb after using play-services-xxx:9.8.00), but i didnt understand anything, what i need to add or remove from my build.gradle files in my situation.
You're mixing libraries from old and new Firebase released. Everything from Firebase that you use should be in parity. This line is reference an library from a very old Firebase release (before it became the Firebase platform at Google):
compile 'com.firebaseui:firebase-ui:0.6.0'
If you want to use the Firebase-UI library, you should use the new version of it that matches the version of the main client library you're using. You're using 10.0.1, so according to the table on the Firebase-UI github I just linked, you want this dependency:
compile 'com.firebaseui:firebase-ui:1.1.1'
Always make sure your Firebase-UI library matches the core Firebase SDK you're using.
It looks like in your case Doug's fix resolved your issue, but we recently encountered the same problem with a different root cause.
In our case, we had configured our IDE project to use JDK8 but failed to check which version of the JDK was in use in the terminal. Because React Native runs Gradle from the command line when you type 'react-native run-android' Gradle was attempting to build using JDK10 which caused obvious issues since Android currently only supports up to JDK8. Once we configured the terminal to use JDK8 the issue was resolved.
TL;DR: Check what version of the JDK you are using in the terminal.
Getting following error:
error: cannot access zza
class file for com.google.android.gms.common.internal.safeparcel.zza not found
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-analytics:17.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
/* implementation 'com.google.firebase:firebase-core:9.2.0' // this line must be included to integrate with Firebase
implementation 'com.google.firebase:firebase-messaging:10.2.1' // this line must be included to use FCM*/
//implementation 'com.google.android.gms:play-services:10.2.1'
implementation 'com.google.android.gms:play-services-maps:10.2.1'
implementation 'com.google.firebase:firebase-core:10.2.1'
implementation 'com.google.firebase:firebase-messaging:10.2.1'
}

Android studio - transformClassesWithDexForDebug error

Here is my graddle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 16
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'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/INDEX.LIST'
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
preDexLibraries = false
}
}
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}
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:multidex:1.0.0'
//Support Library
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
//Test
androidTestCompile 'com.google.code.findbugs:jsr305:3.0.0'
testCompile 'junit:junit:4.12'
//Google Play Services
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
//Common Langs 3
compile 'org.apache.commons:commons-lang3:3.5'
//Google Cloud Translate
compile ('com.google.cloud:google-cloud-translate:0.7.0'){
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'org.json', module: 'json'
}
//Ksoap 2
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
//Gson (Shared Preferences)
compile 'com.google.code.gson:gson:2.7'
//Loading Animation
compile 'com.pnikosis:materialish-progress:1.7'
//Snackbar
compile 'com.androidadvance:topsnackbar:1.1.1'
//SVG Animation
compile 'com.jaredrummler:animated-svg-view:1.0.0'
}
Here is the Androidmanifest.xmlpart
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:configChanges="orientation"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".SplashAnimationActivity"
Here is the android studio error:
Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
Warning:The `android.dexOptions.incremental` property is deprecated and it has no effect on the build process.
Error:trouble processing "javax/transaction/HeuristicCommitException.class":
Error:Ill-advised or mistaken usage of a core class (java.* or javax.*)
Error:when not building a core library.
Error:This is often due to inadvertently including a core library file
Error:in your application's project, when using an IDE (such as
Error:Eclipse). If you are sure you're not intentionally defining a
Error:core class, then this is the most likely explanation of what's
Error:going on.
Error:However, you might actually be trying to define a class in a core
Error:namespace, the source of which you may have taken, for example,
Error:from a non-Android virtual machine project. This will most
Error:assuredly not work. At a minimum, it jeopardizes the
Error:compatibility of your app with future versions of the platform.
Error:It is also often of questionable legality.
Error:If you really intend to build a core library -- which is only
Error:appropriate as part of creating a full virtual machine
Error:distribution, as opposed to compiling an application -- then use
Error:the "--core-library" option to suppress this error message.
Error:If you go ahead and use "--core-library" but are in fact
Error:building an application, then be forewarned that your application
Error:will still fail to build or run, at some point. Please be
Error:prepared for angry customers who find, for example, that your
Error:application ceases to function once they upgrade their operating
Error:system. You will be to blame for this problem.
Error:If you are legitimately using some code that happens to be in a
Error:core package, then the easiest safe alternative you have is to
Error:repackage that code. That is, move the classes in question into
Error:your own package namespace. This means that they will never be in
Error:conflict with core system classes. JarJar is a tool that may help
Error:you in this endeavor. If you find that you cannot do this, then
Error:that is an indication that the path you are on will ultimately
Error:lead to pain, suffering, grief, and lamentation.
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: java.lang.UnsupportedOperationException
Information:Total time: 46.622 secs
Information:34 errors
Information:1 warning
Information:See complete output in console
I am working on a google cloud translate application.
I am getting errors.
I search and ı have try some solution but does not help me.
What isthe problem ?
My libs folder is empty.
please help me.
I had a same issue. In my app I am using guava-retrying library, which was fetching google guava library version 21. Guava version 21 requires JDK 1.8 without providing back porting support and this was causing this error in my case.
I was able to solve it by including the guava-retrying library so that it uses version 19.0 of guava library:
compile ("com.github.rholder:guava-retrying:2.0.0") {
exclude group: 'com.google.guava', module: 'guava'
}
compile 'com.google.guava:guava:19.0'
Basically you would want to check if any of your app's dependencies require JDK 1.8 to compile, and remove/downgrade them.

Compiling compatibility issue external libraries

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.

java.lang.NoClassDefFoundError while testing a Realm app on Android 2.3.3 (API 10 Emulator)

I've been learning realm for the past few days and today I decided to test an app I'm developing on Android using Realm, for backward compatibility.
Emulator details:
Name: Nexus_4_API_10_2.3.3
CPU/ABI: ARM (armeabi)
Path: /home/mush/.android/avd/Nexus_4_API_10_2.3.3.avd
Target: default [Default] (API level 10)
Skin: nexus_4
SD Card: 100M
hw.dPad: no
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: Nexus 4
vm.heapSize: 64
skin.dynamic: yes
hw.device.manufacturer: Google
hw.gps: yes
hw.initialOrientation: Portrait
image.androidVersion.api: 10
hw.audioInput: yes
image.sysdir.1: platforms/android-10/images/
tag.id: default
showDeviceFrame: yes
hw.camera.back: emulated
hw.mainKeys: no
The App crushes as soon as it launches citing LoginActivity.java as the source of the error.
Logcat Snippet:
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: _package_name_.sessions.LoginActivity
at _package_name_.SplashActivity.onCreate(SplashActivity.java:26)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
I then went ahead to comment out the snippet of code that calls the LoginActivity.java.
The snippet:
//Check whether there's an active session first
sessionManager = new SessionManager(getApplicationContext());
if (sessionManager.isSessionActive()) {
//Session is active => Launch the MainActivity
Intent launchMainActivity = new Intent(getApplicationContext(), MainActivity.class);
startActivity(launchMainActivity);
} else {
//Session is inactive => Launch the LoginActivity
Intent launchLogin = new Intent(this, LoginActivity.class);
startActivity(launchLogin);
finish();
}
This did not solve my issue. Instead, Logcat halts at this point and the app freezes at my splash screen.
Logcat:
D/RealmManager: Initializing Realm configuration.
D/dalvikvm: DexOpt: couldn't find static field
W/dalvikvm: VFY: unable to resolve static field 118 (SUPPORTED_ABIS) in Landroid/os/Build;
D/dalvikvm: VFY: replacing opcode 0x62 at 0x0006
D/dalvikvm: VFY: dead code 0x0008-000c in Lcom/getkeepsafe/relinker/SystemLibraryLoader;.supportedAbis ()[Ljava/lang/String;
D/dalvikvm: Trying to load lib /data/data/_package_name_/lib/librealm-jni.so 0x40513a90`
The app runs quite fine on android API level 24. Does this mean realm is backward incompatible?
Here's my build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "_package_name_"
minSdkVersion 10
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 {
// Exclude file to avoid
// Error: Duplicate files during packaging of APK
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
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:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'dk.ilios:realmfieldnameshelper:1.0.0'
compile 'io.realm:android-adapters:1.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0#aar'
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
}
What am I doing wrong? And how do I correct it. I'll appreciate any help.
PS: There appears to be no other question of this sort of StackOverflow. This one comes close though.

Categories

Resources