在com.android.build.gradle.internal.dsl.BaseAppModuleExtension类型的对象上找不到参数[26]的方法ImplementationSdkVersion()

时间:2019-03-08 17:27:01

标签: java android gradle

我希望有人帮助我解决这个Android Studio错误。我已经在互联网上购买了Android应用程序,并且还有android studio项目文件。 事实是,此应用程序是使用较旧版本的Android Studio制作的,大概是一年半以前。 我收到此错误com.android.build.gradle.internal.dsl.BaseAppModuleExtension类型的对象上的参数[26]找不到方法ImplementationSdkVersion()。将所有编译替换为实现后,因为它们显示警告,并且当我尝试从我的android studio项目中获取APK时,APK崩溃了。 这是gradle模块的应用代码: 应用插件:“ com.android.application”

android {
    useLibrary 'org.apache.http.legacy'
    ImplementationSdkVersion 26
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "codecanyon.carondeal"
        minSdkVersion 21
        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'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    productFlavors {
    }
}
repositories {
    mavenCentral() // jcenter() works as well because it pulls from Maven Central
}
dependencies {
    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('org.apache.httpcomponents:httpmime:4.3') {
        exclude module: "httpclient"
    }
    //implementation 'com.android.support:cardview-v7:26.0.0'
    implementation 'com.android.support:appcompat-v7:26.0.0-alpha1'
    implementation 'com.android.support:design:26.0.0-alpha1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
    implementation 'com.squareup.okhttp3:okhttp:3.8.1'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.github.clans:fab:1.6.4'
    implementation 'com.android.support:cardview-v7:26.0.0-alpha1'
    implementation 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    implementation 'com.android.support:support-v4:26.0.0-alpha1'
    implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
    testimplementation 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

2 个答案:

答案 0 :(得分:0)

哦,我终于找到了解决方案。我刚刚更改了

ImplementationSdkVersion 26

compileSdkVersion 26

成功了。 :) ^ _ ^

答案 1 :(得分:0)

这是因为您用实现替换了所有编译