当我更新Android Studio 3.0时,出现错误
unable to merge with dex.
然后我添加了mutiDexEnabled true
并在com.android.support:multidex:1.0.1
中添加了build.gradle
。
然后我收到以下错误:
错误:任务':app:transformClassesWithMultidexlistForDebug'的执行失败。 java.io.IOException:无法写[C:\ Users \ user \ AndroidStudioProjects \ KnightFox-IN BUDGET \ app \ build \ intermediates \ multi-dex \ debug \ componentClasses.jar](无法读取[C:\用户\ user.gradle \缓存\转变-1 \文件-1.1 \播放服务的广告,精简版,11.4.2.aar \ 9a54afd7907fee993ecc421b66ed4228 \罐\ classes.jar(;;;;;; **。类)] (重复的zip条目[classes.jar:com / google / ads / mediation / MediationServerParameters $ Parameter.class]))
的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.copperseeds.android.kunjachamman.applicationin.budget"
minSdkVersion 14
targetSdkVersion 26
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
implementation files('libs/ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar')
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation 'com.android.support:support-annotations:26.0.0'
implementation 'com.android.support:support-v4:26.0.0'
implementation 'com.github.navasmdc:MaterialDesign:1.5@aar'
testImplementation 'junit:junit:4.12'
implementation project(':ORMDroid')
implementation project(':FacebookSDK')
implementation project(':standOut')
implementation files('libs/gcm.jar')
implementation files('libs/google-play-services.jar')
implementation 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.1'
}
答案 0 :(得分:1)
尝试删除应用的构建文件夹而不是清理 - 重建 - 运行您的项目。 如果不能正常工作使缓存无效/重新启动。
快乐的编码!!
答案 1 :(得分:1)
尝试这些步骤后,
第1步:删除所有构建和 .gradle 文件夹,
第2步:在 gradle.properties 中添加以下代码,
SELECT *
FROM MyTable
where Date_of_contract >= '20170101' AND Date_of_contract < '20180101'
第3步:然后同步您的Android项目。
答案 2 :(得分:0)
尝试使用buildToolsVersion "26.0.0"
,然后重新启动Android Studio。
答案 3 :(得分:0)
添加 jar
dependencies
文件
从 Build.Gradle
implementation files('libs/google-play-services.jar')
比 Clear-Rebuild-Run
您的项目
答案 4 :(得分:0)
您不应该使用以+结尾的库。您应该指定一个版本。 implementation 'com.google.android.gms:play-services:+'
应该是
implementation 'com.google.android.gms:play-services:11.4.2'
然后build.gradle将是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.copperseeds.android.kunjachamman.applicationin.budget"
minSdkVersion 14
targetSdkVersion 26
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
implementation files('libs/ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar')
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation 'com.android.support:support-annotations:26.0.0'
implementation 'com.android.support:support-v4:26.0.0'
implementation 'com.github.navasmdc:MaterialDesign:1.5@aar'
testImplementation 'junit:junit:4.12'
implementation project(':ORMDroid')
implementation project(':FacebookSDK')
implementation project(':standOut')
implementation files('libs/gcm.jar')
implementation files('libs/google-play-services.jar')
implementation 'com.google.android.gms:play-services:11.4.2'
compile 'com.android.support:multidex:1.0.1'
}
答案 5 :(得分:0)
如果您没有扩展应用程序类
,则还需要添加清单 <application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
如果您要扩展应用程序类,请按照以下链接中的详细信息进行操作:
https://developer.android.com/studio/build/multidex.html
不要使用罐子,只需直接使用repos
不要使用编译使用implimentation
您还需要更新到Android Studio 3.0版。还要确保在root gradle.build中添加了新的repo:
repositories {
maven {
url 'https://maven.google.com'
}
}
您也可以使用较新的gradle包装器
repositories {
maven {
google()
}
}
如果您在repo中使用过数据绑定,请确保已添加
android {
....
dataBinding {
enabled = true
}
}
这是最好的方法。
在根级别gradle.build使用下面的
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
并在gradle-wrapper.properties
文件中更改包装器版本,如下所示
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
同样在您的应用级别build.gradle中,请确保您使用的是26版本,如下所示
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.xxxx"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}