无法迁移到androidX

时间:2019-02-04 07:32:47

标签: android android-studio gradle androidx

尝试通过Refractor迁移到androidx>迁移到AndroidX,我已经尝试了很多次(使缓存无效并重新启动,清理,重建),但是每次完成一些处理和加载并出现以下错误日志时:

*style="background-image: url('');" * /

这些是我的项目级别gradle文件:

java.lang.IllegalArgumentException: Argument for @NotNull parameter 'element' of org/jetbrains/android/refactoring/MigrateToAppCompatUsageInfo$GradleUsageInfo.<init> must not be null
    at org.jetbrains.android.refactoring.MigrateToAppCompatUsageInfo$GradleUsageInfo.$$$reportNull$$$0(MigrateToAppCompatUsageInfo.java)
    at org.jetbrains.android.refactoring.MigrateToAppCompatUsageInfo$GradleUsageInfo.<init>(MigrateToAppCompatUsageInfo.java)
    at org.jetbrains.android.refactoring.MigrateToAppCompatUsageInfo$AddGoogleRepositoryUsageInfo.<init>(MigrateToAppCompatUsageInfo.java:714)
    at org.jetbrains.android.refactoring.MigrateToAndroidxProcessor$findUsagesInBuildFiles$2.invoke(MigrateToAndroidxProcessor.kt:456)
    at org.jetbrains.android.refactoring.MigrateToAndroidxProcessor.findUsagesInBuildFiles(MigrateToAndroidxProcessor.kt:463)
    at org.jetbrains.android.refactoring.MigrateToAndroidxProcessor.findUsages(MigrateToAndroidxProcessor.kt:220)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:959)
    at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57)
    at com.intellij.refactoring.BaseRefactoringProcessor.lambda$doRun$0(BaseRefactoringProcessor.java:189)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:247)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:736)
    at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:434)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
    at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$10(ApplicationImpl.java:574)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

这些是我的应用程序级别的gradle文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.11'
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.27.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com/' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

3 个答案:

答案 0 :(得分:2)

这是一个已知问题,记录在这里:https://issuetracker.google.com/issues/123303598

一种替代方法是使用和修改此脚本并手动进行转换:https://gist.github.com/dlew/5db1b780896bbc6f542e7c00a11db6a0

答案 1 :(得分:0)

尝试在 <script> var nameInput = document.getElementById('simple-input1'); document.querySelector('form.form').addEventListener('submit', function(e) { //prevent the normal submission of the form e.preventDefault(); console.log("Username: " + nameInput.value); }); var nameInput1 = document.getElementById('simple-input2'); document.querySelector('form.form').addEventListener('submit', function (e) { //prevent the normal submission of the form e.preventDefault(); console.log("Password: " + nameInput1.value); }); </script> 中添加这两行:

gradle.properties

并还将您的库更新为适用于您的用例的最新版本。

答案 2 :(得分:0)

因此,此错误已在Android Studio 3.4中修复。 尽管您必须手动更改大多数导入和XML文件。