如何正确添加犀牛-Android Studio 3.1.4中的Android

时间:2018-09-20 11:49:26

标签: android-studio

当我从github克隆一个Android Studio项目并在PC(Windows 10 Pro)中的Android Studio 3.1.4中运行它时。 运行正常 buld.gradle(模块:应用)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.mad_minicalculator.iqrauniversity.minicalculator"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.faendir.rhino:rhino-android:1.4'
}

当我在Android Studio 3.1.4中重写此应用程序时 当我在buld.gradle(模块:app)中添加编译'com.faendir.rhino:rhino-android:1.5'时, 表示-配置“编译”已过时,已被“实现”和“ api”替换。 它将在2018年底删除。

buld.gradle(模块:应用)

应用插件:“ com.android.application”

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.vitaliebancu.minicalculatoralinasoft"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    compile 'com.faendir.rhino:rhino-android:1.5'
}

1 个答案:

答案 0 :(得分:-1)

错误消息中会记录答案。您必须将“ c​​ompile”替换为“ implementation”,因为不建议使用compile并在2018年底停止工作。

实际上,在浏览旧库时,通常会在其安装指南上看到仍然是“编译”,总是将其替换为“实现”,这样就不会有任何问题。