Error while integrating Realm in Android Studio - java

I am trying to integrate Realm 4.3.1 but I am getting weird error, which I am not able to resolve. I have referred Realm Documentation, I am using
Android Studio 3.0 Canary 4,
Gradle Version 4.1
Android Plugin Version 3.0.0-alpha4
Here is an error
Error:Cause: java.lang.NullPointerException
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:98)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
at com.android.build.gradle.internal.scope.BuildOutput.getOutputPath(BuildOutput.java:222)
at com.android.build.gradle.internal.scope.BuildOutputs.lambda$load$2(BuildOutputs.java:243)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at com.android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.java:245)
at com.android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.java:184)
at com.android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.java:140)
at com.android.build.gradle.internal.ide.BuildOutputsSupplier.lambda$get$1(BuildOutputsSupplier.java:54)
at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:397)
at com.android.build.gradle.internal.ide.BuildOutputsSupplier.get(BuildOutputsSupplier.java:49)
at com.android.build.gradle.internal.ide.BuildOutputsSupplier.get(BuildOutputsSupplier.java:34)
at com.android.build.gradle.internal.ide.AndroidArtifactImpl.getOutputs(AndroidArtifactImpl.java:137)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$ReflectionMethodInvoker.invoke(ProtocolToModelAdapter.java:592)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$AdaptingMethodInvoker.invoke(ProtocolToModelAdapter.java:397)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$PropertyCachingMethodInvoker.invoke(ProtocolToModelAdapter.java:625)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SafeMethodInvoker.invoke(ProtocolToModelAdapter.java:647)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SupportedPropertyInvoker.invoke(ProtocolToModelAdapter.java:670)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$InvocationHandlerImpl.invoke(ProtocolToModelAdapter.java:356)
at com.sun.proxy.$Proxy187.getOutputs(Unknown Source)
at com.android.tools.idea.gradle.project.model.ide.android.IdeAndroidArtifactImpl.<init>(IdeAndroidArtifactImpl.java:56)
at com.android.tools.idea.gradle.project.model.ide.android.IdeVariantImpl.lambda$new$0(IdeVariantImpl.java:59)
at com.android.tools.idea.gradle.project.model.ide.android.ModelCache.lambda$computeIfAbsent$0(ModelCache.java:31)
at java.util.HashMap.computeIfAbsent(HashMap.java:1126)
at com.android.tools.idea.gradle.project.model.ide.android.ModelCache.computeIfAbsent(ModelCache.java:31)
at com.android.tools.idea.gradle.project.model.ide.android.IdeVariantImpl.<init>(IdeVariantImpl.java:58)
at com.android.tools.idea.gradle.project.model.ide.android.IdeAndroidProjectImpl.lambda$new$4(IdeAndroidProjectImpl.java:87)
at com.android.tools.idea.gradle.project.model.ide.android.ModelCache.lambda$computeIfAbsent$0(ModelCache.java:31)
at java.util.HashMap.computeIfAbsent(HashMap.java:1126)
at com.android.tools.idea.gradle.project.model.ide.android.ModelCache.computeIfAbsent(ModelCache.java:31)
at com.android.tools.idea.gradle.project.model.ide.android.IdeModel.copy(IdeModel.java:74)
at com.android.tools.idea.gradle.project.model.ide.android.IdeAndroidProjectImpl.<init>(IdeAndroidProjectImpl.java:86)
at com.android.tools.idea.gradle.project.model.ide.android.IdeAndroidProjectImpl.<init>(IdeAndroidProjectImpl.java:67)
at com.android.tools.idea.gradle.project.model.AndroidModuleModel.<init>(AndroidModuleModel.java:128)
at com.android.tools.idea.gradle.project.sync.idea.AndroidGradleProjectResolver.populateModuleContentRoots(AndroidGradleProjectResolver.java:211)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:366)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.access$200(GradleProjectResolver.java:79)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:902)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:886)
at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:218)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:139)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:79)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.lambda$resolveProjectInfo$0(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:45)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:66)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:139)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:125)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:388)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:445)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:726)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:176)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:556)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:137)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:334)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Application gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.###.###"
minSdkVersion 15
targetSdkVersion 25
versionCode 17
versionName "1.17"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
// compile 'com.github.chrisbanes:PhotoView:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
compile 'id.zelory:compressor:2.1.0'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'testfairy:testfairy-android-sdk:1.+#aar'
compile 'io.realm:realm-android:4.3.1'
}
apply plugin: 'realm-android'
Project Gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
classpath 'io.realm:realm-gradle-plugin:4.3.1'
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Remove compile 'io.realm:realm-android:4.3.1' from you application level build.gradle file and apply apply plugin: 'realm-android' just below apply plugin: 'com.android.application'. Your application level build.geadle will look like below
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.###.###"
minSdkVersion 15
targetSdkVersion 25
versionCode 17
versionName "1.17"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
// compile 'com.github.chrisbanes:PhotoView:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
compile 'id.zelory:compressor:2.1.0'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'testfairy:testfairy-android-sdk:1.+#aar'
}

With the realm 4.3 you need to have gradle 4.1 in your gradle-wrapper.properties like that :
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
I had to update my Android Studio to 3.0.1 in order to have it. That was the reason why I couldnt import realm. ^^

Related

Android Sync issue with SDK versions

I am developing an Android application and I am using 'Firebase-Messaging' library in my application. Now I need to 'proguard' and unfortunatly, 'Firebase' generated errors. I searched for solution and then I change the 'buildToolVersion' version 25.0.0 into 26.0.2. When I changed the versions I got the below error. I tried lot of solutions from internet including the 'Firebase Github' itself, but no good. I am using 'Firebase-Messaging 12.0.1' and below is the error I get.
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(26.0.2) from [com.android.support:design:26.0.2] AndroidManifest.xml:28:13-35
is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
build.gradle(Project)
// 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.2.3'
classpath 'com.google.gms:google-services:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.sample.firebase"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
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:design:26.0.2'
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.jakewharton:butterknife:5.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'me.angrybyte.goose:goose:1.8.0'
compile 'com.flaviofaria:kenburnsview:1.0.7'
compile 'com.google.firebase:firebase-messaging:12.0.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.jpardogo.googleprogressbar:library:1.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
You need to change this line of code:
compile 'com.android.support:appcompat-v7:26.0.0'
with
compile 'com.android.support:appcompat-v7:26.0.2'
All dependencies must be the same version.

Java and Kotlin combined build error (Duplicate Zip Entry)

I have added Kotlin library to my existing project. After that I'm getting the build error. I commented all the recently added libraries and checked the main problem is after adding kotlin library
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [/home/imedrix-server/StudioProjects/kardioscreen-operatorapp/app/build/intermediates/multi-dex/debug/componentClasses.jar] (Can't read [/home/imedrix-server/StudioProjects/kardioscreen-operatorapp/app/build/intermediates/transforms/desugar/debug/76.jar(;;;;;;**.class)] (Duplicate zip entry [76.jar:org/intellij/lang/annotations/Flow.class]))
Project gradle
buildscript {
ext.kotlin_version = '1.2.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath ('com.google.firebase:firebase-plugins:1.0.5') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
}
allprojects {
repositories {
google()
jcenter()
maven {url "https://maven.google.com"}
}
}
And the app gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'com.example.android'
minSdkVersion 20
targetSdkVersion 27
versionCode 17
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
buildConfigField("String", "BASE_URL", "\"url\"")
buildConfigField("String", "API_KEY", "\"key\"")
}
}
productFlavors {
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':controllers')
compile files('libs/achartengine-1.2.0.jar')
compile files('libs/dfuLibrary.jar')
compile 'com.android.support:appcompat-v7:27.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.polidea.rxandroidble:rxandroidble:1.0.2'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
compile 'com.android.support:support-v4:27.0.2'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.jakewharton:butterknife:8.8.1'
testCompile 'junit:junit:4.12'
/*compile 'org.hashids:hashids:1.0.3'
compile 'com.google.dagger:dagger:2.11'
compile 'javax.inject:javax.inject:1'
kapt 'com.google.dagger:dagger-compiler:2.11'
compile 'io.reactivex.rxjava2:rxjava:2.1.3'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.amitshekhar.android:rx2-android-networking:1.0.0'
compile 'com.android.support:multidex:1.0.2'*/
}
apply plugin: 'com.google.gms.google-services'
If I remove the below line from the app gradle everything works fine. But if I add the kotlin library I'm getting the error.
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
How can I use the kotlin and Java together.
Atlast I found the answer, it was due to duplicate entry to annotation which can be solved by using the below lines in the gradle.
configurations {
compile.exclude group : 'org.jetbrains' , module : 'annotations'
}

Google GTM dependencies error

i use the GTM and have a question,please help me
app build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.york.yorkbbs"
minSdkVersion 16
targetSdkVersion 25
versionCode 531
versionName "5.31"
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
preDexLibraries = true
javaMaxHeapSize "4g"
}
lintOptions{
checkReleaseBuilds false
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile project(':library_googlemap')
compile project(':library_jcvideoplayer')
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services-tagmanager:10.2.1'
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.stripe:stripe-android:3.1.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'//exclude group: 'com.squareup.okhttp3', module:'okhttp'
compile 'com.facebook.fresco:fresco:0.14.1'
compile 'com.facebook.fresco:animated-gif:0.14.1'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.2.1'
compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:1.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.4.1'
compile project(':Qupaisdk-release')
compile 'com.google.code.findbugs:jsr305:3.0.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.4'
compile 'com.google.dagger:dagger-compiler:2.0.1'
compile 'com.google.dagger:dagger:2.0.1'
compile 'jp.wasabeef:blurry:2.1.1'
}
project build.gradle
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
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()
}
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.
thanks~
You should rectify your build.gradle
No Need
compile project(':library_googlemap') // Remove this line
Finally
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services-tagmanager:10.2.1'

Error: Failed to resolve: com.android.support:cardview-v7:23.4.0

I was trying to compile the app but these errors showed up what should I do?
Error:Failed to resolve: com.android.support:cardview-v7:23.4.0
Error:Failed to resolve: com.android.support:support-v4:23.4.0
Error:Failed to resolve: com.android.support:customtabs:23.4.0
The source code is
apply plugin: 'com.android.application'
android
{
signingConfigs {}
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig
{
applicationId "com.boonex.oo"
minSdkVersion 15
targetSdkVersion 21
}
buildTypes
{
release
{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories
{
jcenter()
}
dependencies
{
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
}
Try an earlier more specific version of the Facebook SDK.
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
bro.. just look at that.. your compileSdkVersion is 21. so you are not able to use higher version of appCompat gradle. for that first you have to update your sdk to 23.
you can see my gradle and it should be like that:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.apple"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile project(':library')
compile files('libs/httpmime-4.3.jar')
compile files('libs/gcm.jar')
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.firebase:firebase-client-android:2.3.1'
compile files('libs/httpcore-4.3.2.jar')
compile files('libs/httpclient-4.3.3.jar')
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-vector-drawable'
all*.exclude group: 'com.android.support', module: 'animated-vector-drawable'
all*.exclude group: 'com.android.support', module: 'support-annotations'
}
you can see that my compileSdkVesion is 23 so my each com.android.support gradle is 23.
sorry to mention lately.. you also need to change class-path for avoid compatibility issue of latest version.
classpath 'com.android.tools.build:gradle:2.1.2'
and this all thing is only possible when you upgrade your sdk first.

Gradle build error in android studio with appcompact library

I am getting this error
Error:Execution failed for task ':yourapp:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v7/recyclerview/BuildConfig.class
Here is my build.gradle file
android {
compileSdkVersion 22
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.test"
minSdkVersion 15
multiDexEnabled true
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile (project(':library_slidingmenu')) {
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
compile project(':library')
compile 'com.android.support:appcompat-v7:22.2.1'
androidTestCompile 'com.android.support:multidex-instrumentation:1.0.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'org.projectlombok:lombok:1.16.6'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:cardview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.1.0'
Any idea how to solve it?
If you have a dependency that also declares the recyclerview lib then just exclude it from the dependency. For example imagine your lib library_slidingmenu contains the recyclerview dependency, then we would need to do something like this
dependencies {
compile project(':library_slidingmenu') {
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
// the rest of your dependecies
}

Categories

Resources