Blank screen after google play-services upgrade - android

My app uses google maps for 2 years on version com.google.android.gms:play-services:5.0.89. When I try to upgrade, the app will show no GUI, just blank screen.
Probably the same issue as here, but there is no solution but downgrade.
I have tried
compile 'com.google.android.gms:play-services:9.6.0'
and also just subset as I do not use other services
compile 'com.google.android.gms:play-services-maps:9.6.0'
compile 'com.google.android.gms:play-services-analytics:9.6.0'
Here is complete gradle script
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "cz.benhur.vfrdroid"
minSdkVersion 17
targetSdkVersion 23
versionCode 12
versionName "1.12"
// http://developer.android.com/tools/building/multidex.html
//multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
// sourceCompatibility JavaVersion.VERSION_1_7
// targetCompatibility JavaVersion.VERSION_1_7
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
//compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:support-v13:23.4.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-maps:9.6.0'
compile 'com.google.android.gms:play-services-analytics:9.6.0'
// MPAndroidChart, geodesy: apache2 license
compile 'com.dropbox.core:dropbox-core-sdk:2.1.1'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.2'
compile 'org.gavaghan:geodesy:1.1.3'
//testCompile 'junit:junit:4.12'
}

After 2 days spent copy-pasting my code piece by piece to new project I found the problem:
my app have 2 map fragments. I used to call getMap() on each in setUpMapIfNeeded(). I have to update to getMapAsync().
setUpMapIfNeeded() was called from onCreate() and from onResume(). This was probably generated by Android Studio 2 years ago.
If I remove second setUpMapIfNeeded() (or second getMapAsync()), everything works ok.

Related

No Resource found error during compilation| Android

This question is being posted after quite some extensive research and failing at finding the solution. When i try to compile my project i get this error:
Error:(94, 54) No resource found that matches the given name (at 'android:actionModeCloseDrawable' with value '#drawable/abc_ic_ab_back_mtrl_am_alpha').
Below is my build.gradle:
apply plugin: 'com.android.application'
ext {
supportLibVersion = '25.3.1'
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.editor.photoeditor"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:support-annotations:${supportLibVersion}"
compile "com.android.support:support-v4:${supportLibVersion}"
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile('com.afollestad.material-dialogs:core:0.8.1.0#aar') {
transitive = true
}
compile 'com.github.javiersantos:MaterialStyledDialogs:1.4.1'
compile 'com.github.darsh2:MultipleImageSelect:v0.0.4'
compile 'com.github.lopei:collageview:0.1.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.orhanobut:logger:1.11'
compile 'com.adobe.creativesdk.foundation:auth:0.3.94'
compile 'com.adobe.creativesdk:image:4.0.0'
compile 'com.github.QuadFlask:colorpicker:0.0.8'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.cocosw:bottomsheet:1.+#aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
What i have tried up till now:
1) Clean Project and Rebuild Project
2) Deleted build folder and rebuilt project
3) upgraded, downgraded to all possible versions between 23.0.0 and final version of support library given in my build.gradle.
4) Gone through almost every article and most of them propose to change the name of variable #drawable/abc_ic_ab_back_mtrl_am_alpha to R.drawable.abc_ic_ab_back_materia but since it is in <style name="MD_Dark" parent="Theme.AppCompat.Dialog.Alert"> style and problem only shows during compilation, hence, i can not change the name of this item as well.
Following bug was resolved by updating support library version to 25.3.1. After updating the support library version rebuild the whole project and don't just sync the gradle afterwards. Only syncing build.gradle my cause the problem to come up again, so rebuild the whole project every time you have sync the gradle.

Inconsistent behavior when compiling Android apps

I have two Android apps I'm looking at - one that I created a while back and another that I'm just making now. When I try to compile the new one, I get an error "Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
compileSdkVersion 'android-25' requires JDK 1.8 or later to compile." I do not get this error with the old app. Why the difference?
New app's gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.jtriemstra.forceconnectfromphone"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0'
}
Old app's gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.jtriemstra.timeswitch"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.apache.commons:commons-lang3:3.4'
compile 'commons-codec:commons-codec:1.10'
compile 'com.android.support:appcompat-v7:25.0.0'
compile files('libs/nmdp_speech_kit.jar')
}
In both cases, if I go to File > Project Structure, I see it pointed to the same JDK 1.7 path.
The biggest difference I can see is that the new app is using a newer version of Gradle and the Gradle wrapper...which I changed in an effort to solve another problem (see Why "This app has been built with an incorrect configuration" error occured in some phones?) But I would have expected a compile failure to be more at the javac level, not the build manager level.
It looks like the reason is, in fact, the gradle wrapper. If I take a different approach to solving my initial problem, and roll back my changes to the wrapper to use v2.8, the project compiles.

Error: duplicate files during packaging of APK after add Realm dependence to gradle

The problem is happening after I add the Realm Library to my project. I have this dependences in my gradle project:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'io.realm:realm-android:0.87.2'
}
I Found a lot of answers in the StackOverflow and I tested many of this but i have no success. Tryied this answer and this answer but i think my problem is something more specific.
I also added the suggestion of the LogCat error, but im getting the same error. Any answer will be appreciated.
I provide an image of the full error for a better look.
Move your android closure to be after the dependencies closure:
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'io.realm:realm-android:0.87.2'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
The LogCat show this error Gradle DSL method not found: 'packagingOptions()'
Then you do not have packagingOptions inside android.
This is the packagingOptions { I use to typically be able to build anything so far.
android {
...
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'
}
}

failed to find 'com.firebase:firebase-ui:0.2.0' in android studio

I want to use firebase UI in my android app, but it constantly give build error while adding dependency in `android studio
i tried the tutorial at https://github.com/firebase/FirebaseUI-Android#using-the-library-in-your-android-app and
https://www.firebase.com/blog/2015-08-27-firebaseui-makes-mobile-easy.html
But both gives me same error
here is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "re.book.bookify"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
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.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.github.shell-software:viewmover:1.1.0'
compile 'com.github.shell-software:uitools:1.1.0'
compile 'com.firebase:firebase-client-android:2.3.1+'
compile 'com.firebase:firebase-ui:0.2.0'
}
Please post your build.gradle First
Add the following lines to the dependencies object at the bottom:
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebaseui:firebase-ui:0.2.0'
Check This Instructions
https://github.com/firebase/FirebaseUI-Android#using-the-library-in-your-android-app
Thanks Frank van Puffelen, that was the exact problem.
The gradle link given at https://www.firebase.com/blog/2015-08-27-firebaseui-makes-mobile-easy.html is not correct,
The 0.2 version of FirebaseUI was published in the com.firebaseui group. So the gradle link for it is compile 'com.firebaseui:firebase-ui:0.2.0'

Firebase Android SDK causing Gradle error (With no error cause)

I am trying to use Firebase in my Android Studio project and it is giving me an empty Gradle error.
I have tried using the Firebase SDK with Gradle, as well as putting the jar in my libs folder and both give the same blank Gradle error.
i have followed the Android quickstart here: https://www.firebase.com/docs/android/quickstart.html
I put in the packagingOptions and that didn't work. Without an actual error message it's very hard to debug! I haven't written any code for Firebase, i am only trying to get it to run with the Firebase Android SDK without getting a Gradle error
My project works when Firebase is not included.
Any ideas?
Thanks!
Have this content in your build.gradle (Module:app)
android {
//so default auto generated blocks will be here ...
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
} // end of android node
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.firebase:firebase-client-android:2.3.1'
}
Thanks for your help guys, it looks like it was a dex limit error. Adding the Firebase SDK must have put me over the limit, to fix this i had to add multiDexEnabled true in the defaultConfig section of my app:build.gradle file as well as compile 'com.android.support:multidex:1.0.0' in the dependencies
you might need to enable multidex.
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
The complete app/build.gradle from one of my projects:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.firebaseuser.nanochat"
minSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.firebase:firebase-client-android:2.3.1+'
}

Categories

Resources