2017-04-18 2 views
0

내가보고있는 두 개의 Android 앱이 있습니다. 하나는 뒤로, 다른 하나는 지금 만들고 있습니다. 새로운 것을 컴파일하려고 할 때 "오류 : 작업 실행에 실패했습니다 : app : compileDebugJavaWithJavac '. compileSdkVersion'android-25 '에 JDK 1.8 이상이 필요합니다." 이전 앱에서는이 오류가 발생하지 않습니다. 차이점은 무엇입니까?Android 앱을 컴파일 할 때 동작이 일관되지 않음

새로운 응용 프로그램의 Gradle을 파일 : 플러그인 적용 'com.android.application를'

android { 
    compileSdkVersion 25 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     applicationId "com.example.jtriemstra.forceconnectfromphone" 
     minSdkVersion 19 
     targetSdkVersion 21 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 


    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:25.0.0' 
} 

오래된 응용 프로그램의 Gradle을 파일 : 'com.android.application'

android { 
    compileSdkVersion 25 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     applicationId "com.example.jtriemstra.timeswitch" 
     minSdkVersion 19 
     targetSdkVersion 21 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
    } 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'org.apache.commons:commons-lang3:3.4' 
    compile 'commons-codec:commons-codec:1.10' 
    compile 'com.android.support:appcompat-v7:25.0.0' 
    compile files('libs/nmdp_speech_kit.jar') 
} 

: 는 플러그인을 적용 두 경우 모두 File> Project Structure로 이동하면 동일한 JDK 1.7 경로를 가리킨다.

제가 볼 수있는 가장 큰 차이점은 새 앱이 새로운 버전의 Gradle과 Gradle 래퍼를 사용하고 있다는 것입니다 ... 다른 문제를 해결하기 위해 노력했지만 (Why "This app has been built with an incorrect configuration" error occured in some phones? 참조) 컴파일을 기대했을 것입니다. 빌드 매니저 레벨이 아닌 javac 레벨에서의 실패.

+0

파일> 프로젝트 구조> JDK 위치가 JDK 1.8 디렉토리를 가리키는 경우 AndroidStudio를 체크인하십시오. –

+0

고마워,하지만 내 질문에, 그것은 내 JDK 1.7 디렉토리 - 작업 및 비 - 작업 프로젝트 모두 지적했다. – joelt

답변

0

이유는 실제로는 그라데이션 래퍼 인 것처럼 보입니다. 내 초기 문제를 해결하기 위해 다른 접근 방식을 취하고 v2.8을 사용하기 위해 변경 사항을 래퍼로 롤백하면 프로젝트가 컴파일됩니다.

관련 문제