Migrating android app to hosted parse server - android

I'm migrating my android app from Parse android sdk 1.8.1 to 1.13.0. So i can point my app to my hosted Parse server but when i replace the old Parse-1.8.1 to new Parse-1.13.0 library and update the server details in the app. App crash as soon as i run it.
When app crash it shows me below error message in log
03-31 13:55:37.196 2247-2247/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.name.appname, PID: 2247
java.lang.NoClassDefFoundError: bolts.TaskCompletionSource
at com.parse.ParseTaskUtils.callbackOnMainThreadAsync(ParseTaskUtils.java:100)
at com.parse.ParseTaskUtils.callbackOnMainThreadAsync(ParseTaskUtils.java:87)
at com.parse.ParseQuery.findInBackground(ParseQuery.java:1211)
at com.ccna.practicequiz.QuizApplication.onCreate(QuizApplication.java:80)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Dependencies
dependencies {
compile files('libs/Parse-1.13.0.jar')
compile files('libs/bolts-android-1.1.4.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
}
Changes in the app to point app to hosted server
//Parse.initialize(this, "<key>", "<key>");
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("appid")
.clientKey("<random key>")
.server("http://192.168.1.177:1337/parse/") // '/' important after 'parse'
.build());
App is working fine if i use the old Parse-1.8.1 library.I already tried cleaning jar by doing 'gradlew clean jarRelease' and 'gradlew clean testDebug' files still no luck

You might need to update your JAR files, but why use JAR files when you could just grab the dependencies with Gradle?
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}
Also, Play Services is currently 8.4.0 and unless you actually need all the Play Services, then it is recommended to just pick the dependencies you really use.

You have to upgrade bolts-android-1.1.4.jar to the latest version: 1.4.0

Related

android localytics 4.5.1 crash NoClassDefFoundError com.localytics.android.BackgroundService

I updated my localytics from 4.2 to 4.5.
I updated my firebase to the latest ver also 11.6.0.
I am using gradle:
compile 'com.google.android.gms:play-services-ads:11.6.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'com.localytics.android:library:4.5.1'
compile 'com.android.support:appcompat-v7:26.1.0'
Unfortunately the app is crashing at launch time with this trace:
java.lang.NoClassDefFoundError: com.localytics.android.BackgroundService
at com.localytics.android.ManifestHandler.cancelBackgroundTask(ManifestHandler.java:180)
at com.localytics.android.ManifestHandler._onUploadCompleted(ManifestHandler.java:162)
at com.localytics.android.BaseHandler._uploadCallback(BaseHandler.java:326)
at com.localytics.android.BaseHandler$3.run(BaseHandler.java:129)
at com.localytics.android.BaseProvider.runBatchTransaction(BaseProvider.java:403)
at com.localytics.android.BaseHandler._runBatchTransactionOnProvider(BaseHandler.java:154)
at com.localytics.android.BaseHandler.handleMessage(BaseHandler.java:125)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
I have no idea how to fix this (besides reverting to the older version).
Track what is missing and add it. In my case it was gcm dependency.
implementation "com.google.android.gms:play-services-gcm:11.6.2"
You can also try upgrade your support library versions and buildToolsVersion to latest version.

Problems updating PlayServices/Firebase from 10.0.1 to 10.2.0

I am developing an android app using Android Studio and got the message today that there is a new version of Google Play services.
I am using Google play services analytics, ads and tag manager. As well as Firebase analytics/messaging/crash.
The version I had in my build.gradle was 10.0.1 and the new version is 10.2.0
But when I change it, the app crashes on start with:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sega.segaid, PID: 15749
java.lang.NoSuchMethodError: com.google.android.gms.internal.zzaac.zza
at com.google.firebase.FirebaseApp.zzcl(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4964)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4559)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4499)
at android.app.ActivityThread.access$1600(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5191)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:810)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Is this an error on my side? It crashes before the app even starts. The only thing I changed is updating the used dependencies of the play services and firebase.
The last time something like that happened, it was a bug in Firebase, which was fixed by Google after some days.
EDIT:
build.gradle dependencies
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:support-v13:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.android.gms:play-services-base:10.2.0'
compile 'com.google.android.gms:play-services-tagmanager:10.2.0'
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.android.gms:play-services-analytics:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-analytics:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.firebase:firebase-crash:10.2.0'
SOLUTION:
I cleared all caches and also added the version as def instead if writing it out each time. It worked now. Thank you everyone.
I picked the answer by rencsaridogan as solution because I think I forgot to update one of the libraries at my first try and the def is really helpful there. But I also needed to clear caches (as recommended by Avi in the comments below).
There are 2 important things about Google Play Services and Firebase usage as stated in official documentation.
You need to declare the latest classpath of Google Play Services in your root-level gradle, example quoted from given documentation:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
Also, as comments suggest in your project every Google Play Services and Firebase package has to have same version, to ensure this you can follow the method given below (It'll be easier like this, you only need to update version number on definitions)
def googlePlayLibVersion = "10.2.0"
def googleFirebaseLibVersion = "10.2.0"
ext {
annotations = "com.android.support:support-annotations:${supportLibVersion}"
firebaseAnalytics = "com.google.firebase:firebase-core:${googleFirebaseLibVersion}"
firebaseCrash = "com.google.firebase:firebase-crash:${googleFirebaseLibVersion}"
googlePlayAds = "com.google.android.gms:play-services-ads:${googlePlayLibVersion}"
googlePlayGcm = "com.google.android.gms:play-services-gcm:${googlePlayLibVersion}"
googlePlayAnalytics = "com.google.android.gms:play-services-analytics:${googlePlayLibVersion}"
}

com.parse.FacebookAuthenticationProvider error

The app works fine until I've modified the graddle file to put the dependecies of new jar files.
This is the dependecies of the graddle of my app:
dependencies {
compile 'com.parse.bolts:bolts-android:1.1.4'
compile 'com.android.support:support-v4:22.0.0'
provided 'com.facebook.android:facebook-android-sdk:3.23.1'
provided files('libs/Parse-1.9.2.jar') //this is the dependence that I've modified
provided files('libs/ParseFacebookUtils-1.8.4.jar')
}
And this is the dependecies of the graddle of the ParseLoginUI (a github project for integrating the facebook and parse login):
dependencies {
// Module dependency on ParseLoginUI library sources
compile project(':calligraphy-2.1.0')
compile project(':ParseLoginUI')
compile fileTree(include: 'ParseCrashReporting-*.jar', dir: 'libs')
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:cardview-v7:21.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.squareup.picasso:picasso:2.3.4'
}
Now I get this error when the method com.parse.ParseFacebookUtils.initialize is executed:
java.lang.IncompatibleClassChangeError: com.parse.FacebookAuthenticationProvider
at com.parse.ParseFacebookUtils.initialize(ParseFacebookUtils.java:91)
at com.unisa.unistore.MainApplication.onCreate(MainApplication.java:35)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553)
at android.app.ActivityThread.access$1600(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1357)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5256)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
Please, some one can help me?
I've resolved the problem. It seems to be a corrupted jar file or the incompatibility between Parse-1.9.2.jar and ParseFacebookUtils-1.8.4.jar to cause this problem.
Anyway these are the steps that I made to solve the problem:
Recopying the same files again, in the libs directory (i.e. Parse-1.8.4.jar and ParseFacebookUtils-1.8.4.jar);
Substituting Parse-1.9.2.jar with its 1.8.4 version.
I hope that this answer will be useful to someone.
I was getting the same error in my app.
java.lang.IncompatibleClassChangeError: com.parse.FacebookAuthenticationProvider
at com.parse.ParseFacebookUtils.initialize(ParseFacebookUtils.java:94)
I found the reason that i was using different version of libs that i kept in libs folder.
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(dir: 'libs', include: 'ParseFacebookUtilsV4-*.jar')
Both Parse and ParseFacebookUtilsV4 jar should have same version that i.e.
Parse-1.9.2.jar & ParseFacebookUtilsV4-1.9.2.jar
so user both libs of same version that you downloaded from parse.com .
I hope this will help ~~

Google play service make app crash

Here is my gradle:
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.google.android.gms:play-services:7.3.0'
When I remove compile 'com.google.android.gms:play-services:7.3.0' , app works fine, but when put it in, app crashes:
Here is logcat:
java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV11
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:77)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:414)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
at com.laseek.pepe.activity.ActivitySplash.onCreate(ActivitySplash.java:21)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2158)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2244)
at android.app.ActivityThread.access$600(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5092)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
at dalvik.system.NativeStart.main(Native Method)
Thank for your help.
your Android Support Library and Android Support Repository. Just install using the SDK manager. They are not synced with each other. Make sure you have them according to your SDK.
Via the SDK Manager, you need to make sure you have Android Support Repository up to date
If you use Android Studio and want to use the latest Google libraries via Gradle dependency, you will have to update the
You can do this via Tools -> Android -> SDK Manager -> You have to update the stuff under Extras
Check whether you have google-play-services installed.
If not please install them and try syncing the gradle.
I try to install app on my Nexus 5, it works fine, but on other phone with android under version 5.0 it didn't work

New Relic Class Not Found ... I don't even use new relic

I don't even use new relic and I'm getting errors for them. It just happened all of the sudden.
I'm using the latest Android Studio build (0.61). Even my master branch has the same error. There are other projects on my machine that use new relic, but not this one. This project does not use new relic in any way, not so much as a wayward gradle dependency.
I've tried clearing out my gradle cache and re-downloading all the third party libs, didn't work.
StackTrace:
06-15 01:05:54.872 20117-20117/com.waxwings.happyhour.staging D/HappyHourApplication﹕ CREATE TABLE job_holder (_id integer primary key autoincrement , `priority` integer, `group_id` text, `run_count` integer, `base_job` byte, `created_ns` long, `delay_until_ns` long, `running_session_id` long, `requires_network` integer );
06-15 01:05:54.874 20117-20117/com.waxwings.happyhour.staging D/AndroidRuntime﹕ Shutting down VM
06-15 01:05:54.877 20117-20117/com.waxwings.happyhour.staging E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.waxwings.happyhour.staging, PID: 20117
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/newrelic/agent/android/instrumentation/SQLiteInstrumentation;
at com.path.android.jobqueue.persistentQueue.sqlite.DbOpenHelper.onCreate(DbOpenHelper.java:42)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
at com.path.android.jobqueue.persistentQueue.sqlite.SqliteJobQueue.<init>(SqliteJobQueue.java:42)
at com.path.android.jobqueue.JobManager$DefaultQueueFactory.createPersistentQueue(JobManager.java:594)
at com.path.android.jobqueue.JobManager.<init>(JobManager.java:77)
at com.waxwings.happyhour.HappyHourApplication.configureJobManager(HappyHourApplication.java:84)
at com.waxwings.happyhour.HappyHourApplication.onCreate(HappyHourApplication.java:38)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1030)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425)
at android.app.ActivityThread.access$1500(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1270)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.newrelic.agent.android.instrumentation.SQLiteInstrumentation" on path: DexPathList[[zip file "/data/app/com.waxwings.happyhour.staging-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.waxwings.happyhour.staging-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
            at com.path.android.jobqueue.persistentQueue.sqlite.DbOpenHelper.onCreate(DbOpenHelper.java:42)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at com.path.android.jobqueue.persistentQueue.sqlite.SqliteJobQueue.<init>(SqliteJobQueue.java:42)
            at com.path.android.jobqueue.JobManager$DefaultQueueFactory.createPersistentQueue(JobManager.java:594)
            at com.path.android.jobqueue.JobManager.<init>(JobManager.java:77)
            at com.waxwings.happyhour.HappyHourApplication.configureJobManager(HappyHourApplication.java:84)
            at com.waxwings.happyhour.HappyHourApplication.onCreate(HappyHourApplication.java:38)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1030)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425)
            at android.app.ActivityThread.access$1500(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1270)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5102)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
Suppressed: java.lang.ClassNotFoundException: com.newrelic.agent.android.instrumentation.SQLiteInstrumentation
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Class "Lcom/newrelic/agent/android/instrumentation/SQLiteInstrumentation;" not found
... 23 more
build.gradle for module:
apply plugin: 'android'
apply plugin: 'newrelic'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
useOldManifestMerger true
productFlavors {
staging {
applicationId "com.waxwings.happyhour.staging"
}
production {
applicationId "com.waxwings.happyhour"
}
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile 'com.path:android-priority-jobqueue:1.1.2'
compile "com.android.support:support-v4:19.1.0"
compile 'com.google.android.gms:play-services:4.4.52'
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/wearable-preview-support.jar')
compile group: 'com.squareup.okhttp', name: 'okhttp', version: '1.5.3'
compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
compile 'com.jakewharton:butterknife:5.0.1'
compile 'com.squareup.retrofit:retrofit:1.5.1'
compile 'com.squareup:otto:+'
compile 'com.squareup.phrase:phrase:+'
compile 'com.newrelic.agent.android:android-agent:3.402.0'
// Mockito dependencies
androidTestCompile "org.mockito:mockito-core:1.9.5"
androidTestCompile files(
'libs/dexmaker-1.0.jar',
'libs/dexmaker-mockito-1.0.jar')
androidTestCompile ('com.squareup:fest-android:1.0.8'){
exclude group:'com.android.support', module: 'support-v4'
}
androidTestCompile 'com.squareup.spoon:spoon-client:1.1.1'
androidTestCompile('junit:junit:4.11') {
exclude module: 'hamcrest-core'
}
androidTestCompile('com.jakewharton.espresso:espresso:1.1-r3') {
exclude group: 'org.hamcrest:hamcrest-core:1.1'
exclude group: 'org.hamcrest:hamcrest-library:1.1'
exclude group: 'org.hamcrest', module: 'hamcrest-integration'
exclude group:'com.android.support', module: 'support-v4'
}
androidTestCompile ('com.jakewharton.espresso:espresso-support-v4:1.1-r3'){
exclude group:'com.android.support', module: 'support-v4'
}
}
build.gradle for project:
buildscript {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/comnewrelic-1153'
}
maven {
url 'https://oss.sonatype.org/content/repositories/comnewrelic-1154'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
classpath 'com.newrelic.agent.android:agent-gradle-plugin:3.402.0'
}
}
allprojects {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/comnewrelic-1153'
}
}
}
Edit
The project now imports New Relic in the build.gradle per a user suggestions. This fixed the issue but I'm still exploring why, as it doesn't seem like it should be necessary.
The class throwing the error is in Path's JobQueue lib, the library hasn't been updated in 4 months, and my app has been running fine, this just started happening suddenly. The class that is erroring in the 3rd party lib doesn't even use New Relic.
Edit 2
The priority job queue lib does not use new relic. I have no clue why the stack trace says it does, seems like a red herring. I've heard the New Relic SDK modifies the Android API and gives weird errors. But again, I don't use new relic in my project. Is it possible using the NR sdk in another project somehow infected this one (maybe a bug in Android Studio)?
Edit 3
OK, the Priority Job Queue lib in the original stack trace is definitely a false flag. I went ahead and accessed my own Provider before the JobQueue had a chance to access its (knowing this would force the creation of my own DB ahead of the JobQueue lib). My logic was that if Android Sqlite was being infected by New Relic then it would cause a similar error on my own OpenHelper, it did.
06-15 15:29:39.848 1368-1368/com.waxwings.happyhour.staging W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa4d81b20)
06-15 15:29:39.848 1368-1368/com.waxwings.happyhour.staging E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.waxwings.happyhour.staging, PID: 1368
java.lang.NoClassDefFoundError: com.newrelic.agent.android.instrumentation.SQLiteInstrumentation
at com.waxwings.happyhour.services.HHOpenHelper.onCreate(HHOpenHelper.java:56)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)
at com.waxwings.happyhour.services.HappyHourProvider.query(HappyHourProvider.java:121)
at android.content.ContentProvider.query(ContentProvider.java:857)
at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
at android.content.ContentResolver.query(ContentResolver.java:461)
at android.content.ContentResolver.query(ContentResolver.java:404)
at com.waxwings.happyhour.HappyHourApplication.onCreate(HappyHourApplication.java:39)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Edit 4
I just ran the project on a machine that has never had a New Relic library installed in any project and it ran fine. I think this is pretty strong evidence that New Relic is doing something funny w/ their plugin/library.
Edit 5
I updated my gradle-wraper.properties file to use the rc-1 distribution and that seems to have fixed the problem. I removed the new relic dependencies from my build.gradle that one commenter suggested, and the app still runs fine.
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-rc-1-all.zip
My guess is that the New Relic library was being cached in the 1.12-all gradle distro and this was the common link causing other projects to error. I'm still not sure what makes the New Relic library different such that gradle thinks it should include it in other projects. Given that New Relic had an almost identical issue w/ their Eclipse plugin not too long ago, I think it's reasonable to assume there's something going on w/ their Maven distribution. I have a support ticket open with them and I will continue to investigate and report back.
The odd part is if I delete all the gradle distributions/caches/etc in ~/.gradle dir and try to use the 1.12-all distro it still throws that new relic error. The only way it will work is if I use the 1.12-rc-1-all gradle distro.
./gradlew --stop
./gradlew cleanBuildCache
./gradlew clean
works for me
It looks like Android Studio switched over to the gradle daemon for faster builds. Unfortunately, this caches parts of the New Relic agent and it's necessary to stop the daemon when you switch to a project without the agent (or a different version. You can accomplish this simply by running:
gradle --stop
You'll also want to clean your project to ensure the classes are rebuilt and dexed.
While this should get you up and running for now, we'll work on a fix for this issue right away and you can expect it in the next version of the agent.
I tried gradle --stop but it didn't work.
Delete .gradle directory and sync project again, it worked.
I faced the weird issue of NoClassDefFoundError in kitkat. but it was working fine on lollipop.
I tried all the above fix but didn't work.
Finally I come to know that its because of multidex error. I crossed 65k method.
So,I followed this tutorial from android developer site. and worked like charm

Categories

Resources