Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更新到AndroidX库和Gradle 3.4.2后出现的问题_Android_Android Studio_Gradle_Android Gradle Plugin_Androidx - Fatal编程技术网

更新到AndroidX库和Gradle 3.4.2后出现的问题

更新到AndroidX库和Gradle 3.4.2后出现的问题,android,android-studio,gradle,android-gradle-plugin,androidx,Android,Android Studio,Gradle,Android Gradle Plugin,Androidx,我有一个使用webview的简单应用程序。我想在我的应用程序中使用androidx和gradle 3.4.2。所以我对我的gradle文件做了一些更改。见下文: 应用程序级渐变文件: android { compileSdkVersion 28 ......... defaultConfig { ......... minSdkVersion 16 targetSdkVersion 28 .........

我有一个使用webview的简单应用程序。我想在我的应用程序中使用androidx和gradle 3.4.2。所以我对我的gradle文件做了一些更改。见下文:

应用程序级渐变文件:

android {
    compileSdkVersion 28
    .........
    defaultConfig {
       .........
        minSdkVersion 16
        targetSdkVersion 28
        .........
    }
   .........
}
repositories {
    mavenCentral()
}
dependencies {
    .........
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'com.google.android.material:material:1.1.0-alpha09'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.android.gms:play-services-tagmanager:17.0.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.google.firebase:firebase-perf:18.0.1'
    .........
}

apply plugin: 'com.google.gms.google-services'
buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.3.0'
        classpath 'com.google.firebase:perf-plugin:1.3.0'
        classpath 'io.fabric.tools:gradle:1.31.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
systemProp.http.proxyPassword=
systemProp.http.proxyHost=.....
systemProp.http.proxyUser=.....
systemProp.http.proxyPort=8080
android.useAndroidX=true
android.enableJetifier=true
在项目级渐变文件中:

android {
    compileSdkVersion 28
    .........
    defaultConfig {
       .........
        minSdkVersion 16
        targetSdkVersion 28
        .........
    }
   .........
}
repositories {
    mavenCentral()
}
dependencies {
    .........
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'com.google.android.material:material:1.1.0-alpha09'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.android.gms:play-services-tagmanager:17.0.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.google.firebase:firebase-perf:18.0.1'
    .........
}

apply plugin: 'com.google.gms.google-services'
buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.3.0'
        classpath 'com.google.firebase:perf-plugin:1.3.0'
        classpath 'io.fabric.tools:gradle:1.31.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
systemProp.http.proxyPassword=
systemProp.http.proxyHost=.....
systemProp.http.proxyUser=.....
systemProp.http.proxyPort=8080
android.useAndroidX=true
android.enableJetifier=true
在gradle.properties文件中:

android {
    compileSdkVersion 28
    .........
    defaultConfig {
       .........
        minSdkVersion 16
        targetSdkVersion 28
        .........
    }
   .........
}
repositories {
    mavenCentral()
}
dependencies {
    .........
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'com.google.android.material:material:1.1.0-alpha09'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.android.gms:play-services-tagmanager:17.0.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.google.firebase:firebase-perf:18.0.1'
    .........
}

apply plugin: 'com.google.gms.google-services'
buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.3.0'
        classpath 'com.google.firebase:perf-plugin:1.3.0'
        classpath 'io.fabric.tools:gradle:1.31.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
systemProp.http.proxyPassword=
systemProp.http.proxyHost=.....
systemProp.http.proxyUser=.....
systemProp.http.proxyPort=8080
android.useAndroidX=true
android.enableJetifier=true
但是我在同步我的项目后收到了一些警告。项目生成并运行成功。我想删除这些警告,但不知道如何删除这些警告。这些可能会在将来产生问题吗?
请参阅下面的警告:

首先
此版本中使用了不推荐的Gradle功能,使其与Gradle 6.0不兼容。
使用“--warning mode all”(警告模式全部)来显示各个弃用警告。
请参见第二节 在1s内成功构建
14项可执行任务:3项已执行,11项最新
警告:API“variant.getMergeResources()”已过时,已替换为“variant.getMergeResourcesProvider()”。 将于2019年底拆除。
有关更多信息,请参阅。
要确定调用variant.getMergeResources()的内容,请在命令行上使用-Pandroid.debug.obsoletAPI=true以显示更多信息。
受影响的模块:首先是应用程序

此版本中使用了不推荐的Gradle功能,因此 与Gradle 6.0不兼容

警告:API“variant.getMergeResources()”已过时,已被删除 替换为“variant.getMergeResourcesProvider()”。会的 2019年底拆除

出现此警告消息是因为您在应用程序中添加的某些库正在使用过时的代码。您可以忽略此消息,它不会产生任何问题

要确定哪个库正在创建此问题,请执行以下操作:

您可以在gradle.properties文件中包含
android.debug.obsoleteApi=true


重建您的项目,您将能够在logcat中查看有关此问题的详细信息。

在将我的google服务从4.3.0降级到4.2.0后,检查此答案-@DarShan。我没有得到第二次警告。但我还是要面对第一个警告。第一个问题的解决方案是什么。对于第一个问题,如果我在终端中运行命令gradlew--warning mode=all,我会得到第二个问题中显示的相同警告。我想第一个问题和第二个问题都是联系在一起的,但我不知道如何删除这个警告。在项目级别的gradle中将google服务从4.3.0降级到4.2.0后,没有收到第二个警告。