This is my build.gradle(app) file, when I try to Sync this there are 8 warning showing up and when I try to run this application there are few warnings and a error saying there is a Duplicate file Exception
.
I'm trying to implement Google cloud Datastore in my android Application
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.appspot.myapp"
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'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
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:design:25.3.1'
testCompile 'junit:junit:4.12'
compile group: 'com.google.cloud', name: 'google-cloud-datastore', version: '+'
}
Upon hitting Sync Now, I get the following Warnings:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Warning:WARNING: Dependency org.json:json:20160810 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.json:json:20160810 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.json:json:20160810 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.json:json:20160810 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
Information:BUILD SUCCESSFUL
Information:Total time: 1.791 secs
Information:0 errors
Information:8 warnings
Information:See complete output in console
And this is the error that I see when I try to run my application:
Information:Gradle tasks [:app:assembleDebug]
Warning:WARNING: Dependency org.json:json:20160810 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.json:json:20160810 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK com/google/cloud/project.properties
File1: C:\Users\mbhar\.gradle\caches\modules-2\files-2.1\com.google.cloud\google-cloud-core\1.0.0-rc2\aadb514fb6e48585c5fb1b2bbca1a84db38bdd6f\google-cloud-core-1.0.0-rc2.jar
File2: C:\Users\mbhar\.gradle\caches\modules-2\files-2.1\com.google.cloud\google-cloud-core-http\1.0.0-rc2\fe5de264bf8a3357d69f0643d31eca582cee119c\google-cloud-core-http-1.0.0-rc2.jar
Information:BUILD FAILED
Information:Total time: 1.487 secs
Information:1 error
Information:4 warnings
Information:See complete output in console
Excluding those duplicates should get rid of that error
compile('com.google.cloud:google-cloud-datastore:1.0.0-rc2') {
exclude group: 'org.json'
exclude group: 'org.apache.httpcomponents'
}
BUT Android has deprecated Apache HTTP Components from the SDK as of Android 6.
So, I really think you should setup Endpoints because
Google Cloud Endpoints [provides] automated Java object marshalling/unmarshalling to JSON, generation of strongly-typed client libraries that can be called from your Android app, built-in authentication support and so on.
I think that link deploys a Java backend, but I have used this with a Python App Engine app, just can't remember how it worked.