I am trying to add in an older project google ads banner, but when I add to the Grandle the Firebase and run the app it crashes:
This is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com...."
minSdkVersion 15
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.google.firebase:firebase-ads:10.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile files('libs/pinch-0.8.jar')
compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/signpost-jetty6-1.2.1.1.jar')
compile files('libs/twitter4j-async-3.0.3.jar')
compile files('libs/twitter4j-core-3.0.3.jar')
compile files('libs/twitter4j-examples-3.0.3.jar')
}
apply plugin: 'com.google.gms.google-services'
and this is the error message
The first version of the project was developed with Eclipse.
This is because firebase uses new version of android support lib while actionbarsherlock relies on old version. If you still want to use actionbarsherlock you will need to make some changes into it, see here
do not forget to add main firebase project :
compile 'com.google.firebase:firebase-core:10.2.0'
Related
I am using android AIDE app to make android application. Before i factory reset my android, I have all google, android & firebase libraries are downloaded & installed. But after factory reset, when i install again AIDE app, It download only google & firebase library. And when i put firebase dependency in build gradle, it not downloading firebase library for me. Please help me in these case.
Here's my build gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.rb.aagrikoli"
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}}
dependencies {
compile 'com.google.android.gms:play-services-ads:+'
compile 'com.google.firebase:firebase-auth:+'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:support-v4:+'
compile 'com.android.support:appcompat-v7:+'
compile 'com.roughike:bottom-bar:2.3.1'
compile 'com.github.bumptech.glide:glide:4.7.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
apply plugin: 'com.google.gms.google-services'
You should use the latest versions of all library in your gradle file
try to replace all the library accourding to your target SDK
Also change the compileSdkVersion 21
buildToolsVersion "21.1.0" to 25(same with target sdk)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.xxxxx.xx.xx.xx.xxxxx"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "2g"
}
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.0'
compile files('libs/DTBSCommon.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.squareup.dagger:dagger-compiler:1.2.1'
compile 'com.android.support:design:23.1.1'
compile 'org.java-websocket:Java-WebSocket:1.3.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.0.6'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.0.6'
compile 'com.fasterxml.jackson.core:jackson-databind:2.0.6'
compile 'com.android.support:support-v4:23.1.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
}
This error is due to your build tool version and compileSDKVersion.
Here is a workarond for it.
First of all download and install all available updates from SDK Manager.
Then create a new project. As you are using google play services plugin in your current app, apply google play services plugin to newly created project.
Now Compare the build.gradle(Module App) for both the applications and make changes to in your old project build.gradle(module app). Also update the various dependencies to their latest versions. After making changes sync the gradle and it should work like charm.
In this i have alse implemented firebase service of google previously i was not using firebase service so that time my compile 'com.google.android.gms:play-services-location:8.3.0' it was working fine in 4.1 and all the other version of android and now becoz of firebase service i m not able to see map in android 4.1 becoz i have to upgraded the version of google play service to 9.4.0
build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "app.beeonline.com.attendance"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
First, remove the line 'com.google.android.gms:play-services:9.4.0' because it will add all the Google Play and Firebase libraries to you app. It will also increase the build time and the size of the APK file. So replace it with the library that you only need. Here is the link for the Google Play libraries. And this link for the Firebase libraries.
Lastly, I don't see the library for Google Maps, it seems that you forgot to include it.
com.google.android.gms:play-services-maps:9.4.0
And make sure your classpath is like this when using Firebase, because sometimes it is the problem.
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:3.0.0'
}
}
I am working on android studio from one year But i can't face this type of problem. What i am doing is adding a dependency of support library in app build.gradle and then sync the project.
Gradle build running is started in background and then after some time studio is automatically crashed. There is no error or logs are found for crashes. And if I removed the dependency from gradle it works properly. I also restarted the machine and having an latest update of studio but it can't fixed the problem. Thanks in advance for any help.
Here is my app level build.gradle file. I am adding compile 'com.android.support:design:22.2.0' library in my project
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 23
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:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.isseiaoki:simplecropview:1.0.9'
compile "com.mixpanel.android:mixpanel-android:4.8.0"
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.10.1'
}
apply plugin: 'com.google.gms.google-services'
I try to add this lib (https://github.com/daimajia/AndroidImageSlider) to my project. I added the compile library in my gradle file, but i get an error :
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.pp.myapp"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
compile 'com.iangclifton.android:floatlabel:1.0'
compile 'com.google.android.gms:play-services:5.0.89'
compile "com.android.support:support-v4:+"
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.0.9#aar'
}
And i get this error :
Error:Module version com.android.support:support-v13:13.0.0 depends on libraries but is not a library itself
Try adding this dependency:
compile 'com.android.support:support-v13:19.0.+'
You have to install the Android Support Library from the SDK, too.
I got the same error with an oauth library. It was fixed after a while when, tired of implementing new changes to the build.gradle like changing the support libraries, I discarded the changes on the file (via Sourcetree). It synchronized and automatically got fixed.
(Android Studio) It's a kind of magic.