2016-10-23 35 views
15

Tôi đang cố gắng để xây dựng sử dụng Travis CI vào dự án Android của tôi với điều này .travis.yml nộpTravis CI xây dựng thất bại trên ứng dụng Android phiên bản MAJOR.MINOR không được hỗ trợ 52

language: android 
android: 
    components: 
    - platform-tools 
    - tools 
    - build-tools-23.0.3 
    - android-23 
    - sys-img-armeabi-v7a-android-23 
    - sys-img-x86-android-23  

Đây là mức ứng dụng của tôi xây dựng. gradle:

apply plugin: 'com.android.application' 


android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 
    defaultConfig { 
     applicationId "com.myname.myproject" 
     minSdkVersion 19 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
    debug{ 
     testCoverageEnabled = true 
    } 
}} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:23.4.0' 
compile 'com.android.support:design:23.4.0' 

testCompile "org.robolectric:robolectric:3.1.2" 
testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1' 
testCompile 'junit:junit:4.12' 
testCompile 'org.mockito:mockito-core:1.10.19' 

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 

}

tôi nhận được thông báo lỗi này trên Travis CI:

FAILURE: Build failed with an exception. 
* Where: 
Build file '/home/travis/build/myname/myproject/app/build.gradle' line: 1 
* What went wrong: 
A problem occurred evaluating project ':app'. 
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0 
* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or -- debug option to get more log output. 
BUILD FAILED 

Từ lỗi, có vẻ như nó có liên quan đến phiên bản Java. Tôi nhận thấy rằng Travis sử dụng phiên bản Java 1.7.0_76.

Tôi đã thử một số giải pháp tại Unsupported major.minor version 52.0 in my app. Không ai trong số họ đã làm việc cho tôi. Ví dụ, điều này dường như không làm việc:

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

}

CẬP NHẬT: Tôi cố định này bằng cách thêm jdk: oraclejdk8 đến dòng thứ hai của tập tin .travis.yml của tôi sau khi language:android

+2

CẬP NHẬT: Tôi đã sửa lỗi này bằng cách thêm 'jdk: oracle jdk8' vào dòng thứ hai của tệp '.travis.yml' của tôi sau 'ngôn ngữ: android' – Vinnie

+0

Bạn có thể cung cấp câu trả lời bên dưới thay vì nhận xét hoặc cập nhật câu hỏi –

Trả lời

27

UPDATE: Tôi đã sửa lỗi này bằng cách thêm jdk: oraclejdk8 vào dòng thứ hai của tệp .travis.yml của tôi sau language:android

Các vấn đề liên quan