简体   繁体   中英

Could not find method ImplementationSdkVersion() for arguments [26] on object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension

I would like someone to help me with this Android Studio error. I have bought an Android Application in internet, and I have also the android studio project files. The thing is that this application has been made with an older version of Android studio I think, probably like 1 year and a half ago. I get this error Could not find method ImplementationSdkVersion() for arguments [26] on object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension. after replacing all compile with implementation because those showed warnings and when I tried to get an APK from my android studio project that APK crashed on my Samsung. This is the gradle module app code: apply plugin: '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'

Oh I finally found the solution. I just changed the

ImplementationSdkVersion 26

to

compileSdkVersion 26

and it worked. :) ^_^

那是因为你用实现替换了所有编译

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM