在APK COM /谷歌/云/ project.properties复制谷歌的云API重复文件
问题描述:
这是我的build.gradle(应用程序)文件,当我尝试同步此有8警告显示出来,当我尝试运行此应用程序有几个警告和错误说有一个Duplicate file Exception
。在APK COM /谷歌/云/ project.properties复制谷歌的云API重复文件
我试图实现谷歌云存储在我的Android应用程序
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: '+'
}
击中后立即同步,我得到以下警告:
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
这是我看到的错误当我尝试运行我的应用程序时:
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
答
排除这些重复应该摆脱临时牛逼错误
compile('com.google.cloud:google-cloud-datastore:1.0.0-rc2') {
exclude group: 'org.json'
exclude group: 'org.apache.httpcomponents'
}
但 Android已经从SDK过时的Apache HTTP组件由于Android的6
所以,我真的觉得你应该setup Endpoints因为
谷歌云端点[规定]自动Java对象编组/解组到JSON,一代可以从Android应用程序被称为强类型的客户端库,内置的身份验证支持等。
我认为链接部署了一个Java后端,但我已经将它与Python App Engine应用程序一起使用,但不记得它是如何工作的。
云终端是你想要的依赖,对不对?不是整个数据存储区的API? –
其实我想用以下的进口: '进口的java.util.ArrayList;' ,并希望这3只依赖: '谷歌云core' '谷歌云计算的核心http' '谷歌云-datastore' – mbhargav294
再次,终点是你应该如何与数据存储API进行交互。我认为您拥有的依赖关系是针对Java服务器的,而不是针对Android应用程序的。 –