Why i ask, on every solution i jsut have information that apply plugin on bottom, but i have this, but this not work on my side. I try to do this on 5 hours. Im got error after trying to implement google maps on my application. Maybe i miss something in code? I dont know where is problem, so please guys look at code, maybe you will have any idea whats wrong. Thanks fro advice.
This is error:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.company.andrzej.rolki.wroclawnarolkach"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:22.1.0'
}
apply plugin: 'com.google.gms.google-services'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-ads:10.2.1'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.google.firebase:firebase-crash:10.2.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services-analytics:10.2.1'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
}
apply plugin: 'com.google.gms.google-services'
And project
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Remove apply plugin: 'com.google.gms.google-services' line from dependencies block. You wrote it twice.
Related
I am attempting to generate an apk to install to a device. I was able to do this with the same project prior to Android Studio version 3.0.0. I cannot post any error logs because the apk generates successfully, but when I try to install it on a device I get "App not installed", "File appears to be corrupt". I have been through a number of other threads to try and fix this but nothing has worked so far.
The previous version on the phone has been uninstalled.
Both Signed and unsigned have been tried.
Instant run has been disabled.
The apk has failed to install on at least 3 different devices.
I have tried downgrading my com.android.tools.build:gradle
Any help would be greatly appreciated, I feel like I've tried everything.
build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.will3596.mobileapplication"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
dependencies {
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:11.6.2'
compile 'com.google.firebase:firebase-auth:11.6.2'
compile 'com.google.firebase:firebase-database:11.6.2'
compile 'com.google.android.gms:play-services-maps:11.6.2'
compile 'com.google.android.gms:play-services-location:11.6.2'
compile 'com.google.firebase:firebase-storage:11.6.2'
compile 'com.android.support:palette-v7:26.+'
compile 'com.android.support:customtabs:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:mediarouter-v7:26.+'
compile 'com.android.support:multidex:1.0.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.maps.android:android-maps-utils:0.4+'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.7.22'
androidTestCompile 'com.android.support:support-annotations:24.0.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven{
url "https://maven.google.com"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Let me know what else I can post to help get a solution.
Steps to generate debug apk from 3.0.0+
Build->Build APK(s).
I found the answer in another thread somewhere. In my android manifest, I had testOnly="true", set to false and it fixed.
Hello i am working now on android application with 2 modules the first is my app with buildgradle like
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.alexvasilkov:android-sign-release:0.8.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.alexvasilkov.sign'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "dz.condorpos"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
storeFile file("foldable-layout-release-key.keystore")
keyAlias "release"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':library')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.github.barteksc:android-pdf-viewer:1.4.0'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.alexvasilkov:android-commons:2.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.afollestad:easyvideoplayer:0.3.0'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
the second module is a library included to my project here is the buildgradle(module:library):
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
}
}
// New version can be uploaded with 'gradlew clean :library:jar :library:uploadArchives'
apply from: 'gradle-mvn-push.gradle'
dependencies {
}
the project buildgradle is like :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects { project ->
repositories {
jcenter()
maven { url 'https://dl.bintray.com/drummer-aidan/maven' }
}
// Enabling checkstyle for all sub projects
project == rootProject || project.afterEvaluate {
project.apply plugin: 'checkstyle'
project.extensions.getByName('checkstyle').with {
toolVersion = '6.15'
configFile file("${rootDir}/checkstyle.xml")
}
task checkstyle(type: Checkstyle) {
source 'src'
include '**/*.java', '**/*.xml'
classpath = files()
}
project.tasks.getByName('check').dependsOn 'checkstyle'
project.extensions.getByName('android').with {
lintOptions {
ignore 'GoogleAppIndexingWarning', 'ContentDescription'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
}
the project was working perfectly till yesterday when i added a compile dependencies of picasso in my app module after the gradle sync failed it show this
Error:(11, 0) Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed.
now even if i remove picasso the error still happening Of course I did not ask the question before long research i found some solutions but didnt work like this
note : an old version of my project still working normal with the same clean task but after some gardle syncs i will get this problem.
I would like to thank you in advance for your assistance
After so many research i found we have to just comment the line of clean task in bulid.gradle(Project) like below :
// task clean(type: Delete) {
// delete rootProject.buildDir
// }][1]
I read many posts on this topic, but no one helped me.
I'm using Android Studio and following this guide
This is the project gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
this is the app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.xyv.appname"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
Here you can see where I added google-services.json inside my app:
These are my SDK tools:
Does anybody understand what's my error?
Thank you in advance
You may need to add
compile 'com.google.android.gms:play-services:9.6.1'
in your app build.gradle also. ref: Upgrade to Google Play Services:9.0.0 Error Failed to resolve: com.google.android.gms:play-services-measurement:9.0.0
If you recently bumped the version to 3.0.0 you should doublecheck that you have installed the correct version on your machine in the Android SDK manager.
Open the stand alone SDK Manager, in the Extras section the you will find "Google Play Services" update it .
I resolve my issue by updating android studio to 2.3 beta 2
I did just update an android studio and all is ruining well
In my Android app I'm trying to implement ORM for SQLite database for existing db. I've tried to implement activeandroid and DBFlow, but Android studio shows error that it can't recognize method. Here's how it shows when I try to use DBFlow ORM and similarly for activeandroid it doesn't recognize methods in annotations. The red in below screenshot is error. It says it can't recognize method databaseName and also constant PRIMARY_KEY doesn't exist.
Here's project build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here's app: build.gradle
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.myapplication"
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'])
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.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'org.immutables:gson:2.0.6'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup:otto:1.3.8'
compile 'com.airbnb:deeplinkdispatch:1.5.0'
apt 'com.airbnb:deeplinkdispatch-processor:1.5.0'
apt 'com.github.Raizlabs.DBFlow:dbflow-processor:3.0.0-beta1'
compile "com.github.Raizlabs.DBFlow:dbflow-core:3.0.0-beta1"
compile "com.github.Raizlabs.DBFlow:dbflow:3.0.0-beta1"
}
I've managed to setup a java test in my project however I've fallen into two different pitfalls.
1) I make a Java module, I can run it and do some arbitrary tests but since my Viewmodels/presenters/models are all in my Android project it means I cannot get the objects. That's a pretty big problem, I suppose an alternative would be to create a module for just the Presenters or ViewModels + Models.. but that seems bad
2) I make a folder under src/test/java/... however when I'm in there and try to compile, due to the lambda expressions in my project I end up getting weird compilation errors due to retrolambda.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for java.lang.invoke.MethodType not found
How do I go about setting up my gradle to testCompile in a way where Retrolambda isn't messing things up? Below is my gradle for the project
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.3"
}
}
apply plugin: "net.ltgt.apt"
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "io.patrykpoborca.cleanarchitecture"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
encoding "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
dependencies {
apt 'com.google.dagger:dagger-compiler:2.0'
testApt 'com.google.dagger:dagger-compiler:2.0'
//needed to resolve compilation errors, thanks to tutplus.org for finding the dependency
// http://stackoverflow.com/questions/27036933/how-to-set-up-dagger-dependency-injection-from-scratch-in-android-project
//test compiles
androidTestApt 'com.google.dagger:dagger-compiler:2.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.dagger:dagger:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.jakewharton:butterknife:7.0.1'
androidTestCompile 'com.google.dagger:dagger:2.0'
testCompile 'com.google.dagger:dagger:2.0'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.3'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'org.mockito:mockito-core:1.+'
androidTestCompile('com.android.support.test:runner:0.3') {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
}
}
P.s. does anyone know how to set a Java module's JavaVersion? In my java module Lambda's compiled despite being told that the version of java was wrong... really weird, here's the gradle of the java module. Thanks!
apply plugin: 'java'
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.3"
}
}
apply plugin: "net.ltgt.apt"
dependencies {
apt 'com.google.dagger:dagger-compiler:2.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
testCompile 'com.google.dagger:dagger:2.0'
testCompile project(':app')
}