2017-11-22 15 views
0

저는 Android에 익숙하지 않아이 튜토리얼 (방 데이터베이스 부분 만) : here을 사용해 보려고합니다. 이 문제는 내가 (방에 대한 스키마 export 디렉토리에 대한) 또 다른 오류를 수정 this을 따라 한 후 표시 듯dex - gradle 3.0.0을 병합 할 수 없습니다.

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

: 내 응용 프로그램을 실행하면

나는 다음과 같은 오류가 발생합니다. 나는이 문제를 multiDexEnabled true으로 수정하고 clean/re-build를 사용하여 해결하는 방법에 대해 this post's 조언을 따르려고했지만 작동하지 않았습니다.

모든 조언을 주시면 감사하겠습니다. 이것은 내가 여기있는 첫 번째 게시물입니다. 그래서 내가 잘못한 것이 있다면 알려주세요.

프로젝트 Gradle을 :

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 

    repositories { 
     google() 
     jcenter() 
    } 
    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 
    } 
} 

ext { 
    buildToolsVersion = "25.0.2" 
    supportLibVersion = "25.3.1" 
    archRoomVersion = "1.0.0-alpha1" 
} 

allprojects { 
    repositories { 
     google() 
     jcenter() 
     maven { url 'https://maven.google.com' } //needed for Room 

    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

앱 Gradle을 :

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    defaultConfig { 
     applicationId "com.example.myname.room_example" 
     minSdkVersion 21 
     targetSdkVersion 26 
     multiDexEnabled true 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 

     javaCompileOptions { 
      annotationProcessorOptions { 
       arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] // Room schema 
      } 
     } 

    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    implementation fileTree(dir: 'libs', include: ['*.jar']) 
    implementation 'com.android.support:appcompat-v7:26.1.0' 
    implementation 'com.android.support.constraint:constraint-layout:1.0.2' 
    testImplementation 'junit:junit:4.12' 
    androidTestImplementation 'com.android.support.test:runner:1.0.1' 
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 
    implementation 'com.android.support:multidex:1.0.2' 

    implementation "android.arch.persistence.room:runtime:1.0.0-alpha1" 
    annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha1" 
    implementation 'com.android.support:support-annotations:27.0.0' 
} 
+0

'buildToolsVersion = "26.0.2"'및'클래스 경로 'com.android.tools로 . 빌드 : gradle : 2.3.3 '' –

답변

0

업데이트 buildToolsVersion 아래 코드에서 최근에 supportLibVersion.

ext { 
buildToolsVersion = "25.0.2" 
supportLibVersion = "25.3.1" 
archRoomVersion = "1.0.0-alpha1" 

}

그리고 깨끗하고 작동하는지 확인하기 위해 프로젝트를 다시 빌드합니다.

+0

도움 주셔서 감사합니다, unfortunatel 이 문제가 해결되지 않았습니다. – David

0

해결책을 찾았습니다. 교체 :

"android.arch.persistence.room:runtime:1.0.0-alpha1" 

"android.arch.persistence.room:compiler:1.0.0-alpha1" 

"android.arch.persistence.room:runtime:1.0.0" 

"android.arch.persistence.room:compiler:1.0.0"