Apps hangs on Marshmallow - android

My Android app is working perfectly up to Lollipop. But it is hanging in Marshmallow.
When I open the app,back to home button,again open the app. It hangs. I have used all these libraries:
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.google.android.gms:play-services-analytics:9.0.2'
compile "com.google.android.gms:play-services:9.0.2"
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.android.support:multidex:1.0.0'
And i use :
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.appid"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}

What time of exception are you getting?
Check to see if you're requesting any of these permissions: https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous
If you are, then you will have to specifically request them using requestPermissions

I have found the solution.
I have just updated libraries to the latest libraries ie
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.mcxiaoke.volley:library:1.0.1'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile "com.google.android.gms:play-services:9.2.0"
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.android.support:multidex:1.0.1'
Since i haven't use dangerous permission i dont need to handle on runtime.

Related

Wear App Doesnt install on watch when running a release build

I am working on a watch app which also has a handheld app. Requirement is that watch app should install automatically onto watch once app is installed on the phone. But unfortunately, I am not able to get that done.
I know I need to do a release APK. I have been trying to do same but still not able to get it done. I also uploaded app on google play store to see if that can help me but still no luck can anyone let me know what I am doing wrong. Have been stuck on this for last few weeks any kind of help will be really appreciated.
Here is my Phone app gradle
compileSdkVersion 25
buildToolsVersion "25.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
// office id
applicationId "appid"
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
versionCode 8
versionName "1.0.7"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':ImageGrid')
wearApp project(':wear')
compile 'com.google.android.gms:play-services-wearable:10.0.1'
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 'com.android.support:cardview-v7:25.3.1'
compile 'com.tf.library.tabs:tftabs:2.1.0'
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile 'com.shaishavgandhi:login-buttons:0.1.1'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'jp.wasabeef:glide-transformations:2.0.2'
compile 'it.sephiroth.android.library.picasso:picasso:2.5.2.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:gridlayout-v7:25.3.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.6.0'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
//CHAT UI
compile 'hani.momanii.supernova_emoji_library:supernova-emoji-library:0.0.2'
compile 'me.himanshusoni.chatmessageview:chat-message-view:1.0.3'
// AUTH
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.0'
//DATABASE FIREBASE,UI
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.firebaseui:firebase-ui-database:1.0.1'
//STORAGE FIREBASE
compile 'com.google.firebase:firebase-storage:10.0.0'
//Places SERVICES
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.0'
compile 'com.google.firebase:firebase-crash:10.0.0'
compile 'com.android.support:multidex:1.0.0'
// compile 'com.google.android.gms:play-services-maps:9.6.1'
// compile 'com.google.android.gms:play-services:8.4.0'
compile 'org.jsoup:jsoup:1.8.3'
compile 'com.victor:lib:1.0.1'
compile 'com.github.myinnos:AwesomeImagePicker:1.0.1'
compile 'com.adityak:browsemyfiles:1.4'
compile 'id.zelory:compressor:1.0.4'
compile files('libs/aspectjrt-1.7.3.jar')
compile files('libs/isoparser-1.0.6.jar')
}
And this is my wear app gradle file
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "appid"
minSdkVersion 18
targetSdkVersion 22
versionCode 7
versionName "1.0.6"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v13:25.3.1'
provided 'com.google.android.wearable:wearable:2.0.3'
compile 'com.google.android.support:wearable:2.0.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'jp.wasabeef:glide-transformations:2.0.2'
compile 'com.google.android.gms:play-services-wearable:10.0.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.6.0'
}
Just to make sure it work I have package name for both app and wearable same
Please help me on this.
Thank you
As stated in this thread, try to check your permissions. The Smartphone part needs to have all the permissions the Wear component has.
You may also check this post for reference.
...in build.gradle file of your phone app, you should mention the exact name of the wear app folder. If you created the project in Android Studio, then your build.gradle should look like this:
wearApp project(':wear')
This can happen because of the following reasons:
Wear & Mobile app's "permissions" are not same.
Package name of Wear & Mobile apps are not matching.
Application ID (build.gradle file) of Mobile & wear app are not matching.
Asset Compression
Hope this helps!

"Method references in a .dex file cannot exceed 64K" after changing build.gradle

I'm getting that error that says I have too many method references:
Error:The number of method references in a .dex file cannot exceed 64K.
It all started when I tried to change my targetSdkVersion to 24 and minSdkVersion to a lower sdk (19) via the gradle app file. That led me to having to change some values throughout the file like
compile 'com.android.support:appcompat-v7:23.0.0'
to
compile 'com.android.support:appcompat-v7:24.1.1'
I've read that people get this error when they have the wrong values in build.gradle. Here was my original build.gradle before the changes:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.delbridge.seth.alarm"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
Any thoughts as to what's causing this?
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'org.jsoup:jsoup:1.9.2'
compile 'org.jdeferred:jdeferred-android-aar:1.2.4'
compile 'com.google.android.gms:play-services-appindexing:9.0.2'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
compile 'com.google.firebase:firebase-ads:9.0.2'
}
apply plugin: 'com.google.gms.google-services'
And here is my build.gradle currently:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.delbridge.seth.alarm"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'org.jsoup:jsoup:1.9.2'
compile 'org.jdeferred:jdeferred-android-aar:1.2.4'
compile 'com.google.android.gms:play-services-appindexing:9.4.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
}
apply plugin: 'com.google.gms.google-services'
You're unnecessarily including all of Google Play Services with this line:
compile 'com.google.android.gms:play-services:9.4.0'
So, remove that line and leave the ones that include the individual components:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'org.jsoup:jsoup:1.9.2'
compile 'org.jdeferred:jdeferred-android-aar:1.2.4'
compile 'com.google.android.gms:play-services-appindexing:9.4.0'
//remove this line:
//compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
}
Note:
If the above solution does not solve your issue, then you will need to enable multidex.
try this in your build.gradle file:
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 14 //lower than 14 doesn't support multidex
targetSdkVersion 22
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
check this page: https://developers.google.com/android/guides/setup
and use needed google play service

Can't resolve the dependency

My all other dependencies are successfully being resolved except-:
compile 'com.parse.bolts:bolts-android:1.2.1'
compile 'com.parse:parse-android:1.+'
My build.gradle is -:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.transenigma.iskconapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
//multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.parse.bolts:bolts-android:1.2.1'
compile 'com.parse:parse-android:1.+'
compile 'joda-time:joda-time:2.9.1'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.makeramen:roundedimageview:1.5.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.nineoldandroids:library:2.4.0'
}
There is no problem in other libraries. Actually I made this project using internet without proxy and now I have changed Internet to that of proxy. although I have made changes in the settings but still these 2 dependencies are not being resolved. All other dependencies are successfully being resolved meaning that the internet is working properly. What is the issue.
You can use buildToolsVersion "23.0.1"
Use compile 'com.parse:parse-android:1.12.0' instead of yours .
Actually compile 'com.parse:parse-android:1.+' is not suitable (old ) for your dependencies & It's a Exact Version .

No class found exception com.squareup.okhttp.logging.HttpLoggingInterceptor

Even after adding the dependencies and importing the class I am getting java.lang.NoClassDefFoundError: com.squareup.okhttp.logging.HttpLoggingInterceptor.
Can anyone please help?
Gradle Build file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "xyz"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
mavenCentral()
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
}
In my case, I found that the versions of the okhttp3 and okhttp3:logging-interceptor dependencies needed to exactly match. So for example:
...
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
...
Could be a compatibility problem with retrofit.
Try with :
implementation 'com.squareup.okhttp:logging-interceptor:2.5.0'
This post could be help
App crash on HttpLoggingInterceptor
Also it can be connected with multidex true option in your build.gradle (yes, seems like some devices have problems with multidex apps (read, Samsung))
If this is your case, switch this flag off and rebuild your project. Consider using
minifyEnabled true
shrinkResources true
to reduce your apk size. If it is still too large, that's really weird and bad news, but there are some techniques to put your apk on diet.

issue Execution failed for task ':app:dexDebug'. finished with non-zero exit value 2

I make one project like below structure
my build.gradel file as below
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "pkg.com.appname"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
/*compile fileTree(dir: 'libs', include: ['*.jar'])*/
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/commons-io-2.4.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-core-4.48.jar')
compile 'com.google.android.gms:play-services:7.5.0'
}
I tried all possibility as per current accepted answer like below
1. Comment dependency lib line form build.gradle
dependencies {
/*compile fileTree(dir: 'libs', include: ['*.jar'])*/
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/commons-io-2.4.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-core-4.48.jar')
compile 'com.google.android.gms:play-services:7.5.0'
}
but if i remove this than in my class file getting error like your library is missing for this class
2. By making change line as compile to provided
when i making above change than my application not run and give message like like null pointer due to library not getting to respective class.
So i m getting confuse which way i follow for this any idea how can i solve this problem? your all suggestions are appreciable.
In defaultConfig add :
multiDexEnabled = true
And in same build.gradle add :
dexOptions {
javaMaxHeapSize "4g"
}
And in dependencies add :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.0'}

Categories

Resources