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
Related
Hej Guys
I have developed a cordova crossplatform app which if build in debug works fine but when build in release the app keeps crashing. Following are the versions I am using.
Cordova-cli: 8.0.0
Cordova-android: 7.1.1
Npm: 6.4.1
Node: 8.12.0
I have an idea about that its com.android.support libraray which is causing the problem as in my build.gradle file there are multiple versions of the support library.
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
compile "com.google.android.gms:play-services-location:11.6.2"
compile "com.android.support:appcompat-v7:27.0.0"
compile "com.android.support:support-v4:24.1.1+"
compile "com.android.support:support-v4:+"
compile "com.android.support:support-v4:27.+"
compile "com.android.support:support-v13:27.+"
compile "me.leolin:ShortcutBadger:1.1.17#aar"
compile "com.google.firebase:firebase-messaging:11.6.2"
compile "com.squareup.okhttp3:okhttp:3.+"
// SUB-PROJECT DEPENDENCIES END
}
From what i have read from different sources the library version should be aligned to use the same version.
I am using cordova-android-support-gradle-release plugin to fix android-support version to 26.+. If I set the android-support version less then 26.+ then i get the following error: Constructor Builder in class Builder cannot be applied to given types
The Plugins which are setting the support library version in my solution are:
phonegap-plugin-push: plugin-version: 2.2.3, support-library-version v13:27.+
phonegap-plugin-barcodescanner: plugin-version: 8.0.0, support-library-version v4:27.+
cordova-plugin-file-opener2: plugin-version: 2.0.19, support-library-version v4:+
cordova-plugin-camera: plugin-version: 4.0.3, support-library-version v4:24.1.1+
How do I align Support library versions? Should i edit the Plugin.xml of the plugin which is setting the Support library version or should I create a Build-extra-gradle file?
Is It com.android.support library that is causing the app to crash if yes then why is the app not crashing when build in debug?
Any help would be appreciated. Thanks :)
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.
Today I tested my app on a new device (see below) and I'm getting an exception right at launch. I can't event start the main activity.
Device: Genymotion Samsung Galaxy S2 - Android 4.1.1 - API 16
No google play services installed.
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.firebase.g
at com.google.firebase.b.a(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1058)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4560)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4190)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4132)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
gradle build:
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.app"
minSdkVersion 10
targetSdkVersion 21
multiDexEnabled true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3#aar'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
}
Is it crashing because of missing Play Services?
Note: I have implemented firebase about a month ago, and It's working on other devices.
Although you have multiDexEnabled true in your build.gradle file, you are missing compile 'com.android.support:multidex:1.0.1' in your dependencies. I doubt that Mulidex is working. Review the Multidex configuration instructions and make sure you have done everything correctly.
Also, it is not good practice to include compile 'com.google.android.gms:play-services:9.4.0'. That adds all the Google Play and Firebase libraries to you app, increasing build time and the size of the APK file. Replace the dependency on play-services:9.4.0 with only the libraries you need. A list of the Google Play libraries is provided here, the Firebase libraries are listed here.
Try adding this apply plugin: 'com.google.gms.google-services' to the end of your gradle build file
You're correct, Firebase requires Google play services. As mentioned here in the release announcement for Google Play Services 9.0:
Google Play Services 9.0
Firebase was built using Google Play services 9.0
Add this line in the Application Tag on manifest file:
android:name="android.support.multidex.MultiDexApplication"
I have an an android app that is working correctly on 24.0.0 -- below are my gradle dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:palette-v7:24.0.0'
compile files('libs/ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar')
}
But I downloaded the most recent SDK, and am interested in upgrading to 24.2.0. Since I need the support libraries, I added com.android.support:support-v4 to the dependencies as follows:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:24.2.0'
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.android.support:palette-v7:24.2.0'
compile files('libs/ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar')
}
This causes the following exception:
java.lang.NullPointerException: Attempt to invoke virtual method
'android.graphics.drawable.Drawable[] android.widget.TextView.getCompoundDrawables()'
on a null object reference
at android.support.v4.widget.TextViewCompat.getCompoundDrawablesRelative(TextViewCompat.java:285)
Did I miss something in the documentation that I should do outside of including support-v4 when upgrading? This is my reference:
https://developer.android.com/topic/libraries/support-library/features.html#v4
Note: Prior to Support Library revision 24.2.0, there was a single v4 support library. That library was divided into multiple modules to improve efficiency. For backwards compatibility, if you list support-v4 in your Gradle script, your APK will include all of the v4 modules.
Thanks for your help!
I get the exact same exception after upgrading to support library revision 24.2.0 and build tools 24.0.2 when trying to inflate a layout that includes a TextInputLayout that does NOT have an EditText inside of it.
If I comment out the TextInputLayout without the EditText inside it, the exception goes away. If this is not possible, I would recommend rolling back to the previous version of the support library until this is resolved.
update your Android Sdk Build-tools to
24.0.2
and add them as buildtools in module app build.gradle
Try to clean & rebuild your project
it helps to clear previous applied dependencies from cache.
update
Try to run this app in Api24 with 7.0 emulator since your target sdk is 24
may be it will help you
but as your min sdk is 21 so this also works on that emulators too.
also follow this
Android Studio-> File -> Invalidate cache and Restart android studio
Invalidate Restart
It can be that you are wrapping something other than a
android.support.design.widget.TextInputEditText
with a
android.support.design.widget.TextInputLayout
I recently hit this problem and found the issue to be the following in the layout file
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="100dp">
</android.support.design.widget.TextInputEditText>
This was from the default google login example.
Removing this fixed the nullpointer error.
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