1

我的朋友给了我一个在 Windows 平台上构建的项目,我有 ubuntu。所以当我导入项目时,我收到了这个错误,

Error:(1, 0) Cause: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

如何让我的项目运行。我已经尝试了所有可能的解决方案,但其中任何一个都没有奏效。

我已经指出了我的 SDK 路径并使用了 JDK 1.7.0。使用最新的 Gradle 2.14.1。

这是我的 gradle.build 文件。

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.1"
        useLibrary 'org.apache.http.legacy'

        defaultConfig {
            applicationId "com.example.lenovo.myapp"
            minSdkVersion 19
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        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'
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.google.api-client:google-' +
                'api-client-gson:+'
        compile 'com.android.support:appcompat-v7:23.4.0'
        compile 'com.android.support:design:23.4.0'
        compile 'com.google.http-client:google-http-client-android:+'
        compile 'com.google.api-client:google-api-client-android:+'
        compile 'com.google.code.gson:gson:2.2.4'
        compile 'org.apache.httpcomponents:httpclient:4.5'
        compile 'com.google.android.gms:play-services-identity:9.2.1'
        compile 'com.google.android.gms:play-services-plus:9.2.1'
        compile 'com.google.android.gms:play-services-gcm:9.2.1'
        compile 'com.mcxiaoke.volley:library-aar:1.0.0'
        compile 'org.apache.httpcomponents:httpcore:4.4.1'
        compile 'org.apache.httpcomponents:httpmime:4.3.6'
        compile 'com.squareup.retrofit2:retrofit:2.1.0'
        compile 'com.squareup.okhttp:okhttp:2.3.0'
        compile 'com.squareup.retrofit2:converter-gson:2.1.0'
        compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha5'
        compile 'com.github.bumptech.glide:glide:3.6.0'
        compile 'com.jakewharton:butterknife:6.1.0'
        compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.1.3'
        testCompile 'junit:junit:4.12'
    }

任何解决方案将不胜感激。自从过去 2 天以来,我被困住了。

4

2 回答 2

3

我已经指出我的 SDK 路径并使用 JDK 1.7.0

您需要带有新版 Studio 和构建工具的 JDK 1.8。

于 2016-08-22T09:13:24.300 回答
1

您正在尝试使用 JDK 1.7。该项目基于 1.8(52.0 - 请参阅此链接How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version)构建。因此,可能使用 1.8 JDK 和 JRE 可能对您有用。

于 2016-08-22T09:15:45.910 回答