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

标签 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'

最佳答案

哦,我终于找到了解决方案。我只是改变了

ImplementationSdkVersion 26


compileSdkVersion 26

它奏效了。 :) ^_^

关于java - 在 com.android.build.gradle.internal.dsl.BaseAppModuleExtension 类型的对象上找不到参数 [26] 的方法 ImplementationSdkVersion(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55068154/

相关文章:

android - 获取服务对象

android - 使用 gradle-bintray-plugin 在 bintray 上发布

java - 在 MySQL 数据库中存储枚举

android - 隐藏 Ormlite 的调试日志

java - JAVA 堆栈和链表中缺少数字吗?

android - Firebase 设置问题

gradle - 无法获取未知属性 'publishableFiles'

gradle - 如何从 gradle 中的父项目复制属性

导入类时Java运行代码

java双缓冲性能