问题描述
我刚刚创建了一个新的flutter项目,添加了一些插件,并且我将插件切换到了android x,因此我需要切换到android x.我尝试了所有不同的方法来迁移到android x,到目前为止,没有一种方法对我有用.现在,我什至不知道该怎么办,它是如此令人沮丧,为什么在自动创建新项目时不那么处理.可能在项目中使用了离子性.
I just created a new flutter project, added a few plugins and I'm getting the plugin switched to android x therefore i need to switch to android x. I've tried all the different ways of moving to android x and none has worked for me so far. Right now i don't even know what to do anymore, its so frustrating, why wouldn't flutter handle that when creating new projects automatically. Might be using ionic for the project.
推荐答案
在创建新项目时,只需遵循 @harsh'的答案,您就完成了.
As you are creating a new project, just follow @harsh 's answer and you're done.
但是,当我最近升级我的现有应用程序以使用新的插件时,我也必须迁移到AndroidX ...以及官方说明不起作用,它正在使用Android Studio迁移项目-提示未找到用法!".
However, as I recently upgraded my existing app to use new plugins, I had to migrate to AndroidX as well... and the default procedure in the official instructions didn't work, which is using Android Studio to migrate the project - it said "No usages found!".
所以我所做的是:
- 将Android Studio更新为3.3
- 尝试菜单重构">迁移到AndroidX
- 获得未发现用法"(如果您设法在此处进行操作,请停止!完成!!)...实际上,您可以给尝试一下,然后继续)
- 打开
android/gradle.properties
并添加
- updated Android Studio to 3.3
- tried menu Refactor > Migrate to AndroidX
- got "No usages found" (if you manage to do it here instead, stop! you're done! ... actually, you can give this answer a try before continuing)
- opened
android/gradle.properties
and added
android.useAndroidX=true
android.enableJetifier=true
-
打开
android/build.gradle
并更改
-
com.android.tools.build:gradle
到版本3.3.0
-
com.google.gms:google-services
到版本4.2.0
com.android.tools.build:gradle
to version3.3.0
com.google.gms:google-services
to version4.2.0
打开android/app/build.gradle
和
- 将
compileSdkVersion
更改为28
- 将
android.support.test.runner.AndroidJUnitRunner
替换为androidx.test.runner.AndroidJUnitRunner
- 将
com.android.support.test:runner
替换为androidx.test:runner:1.1.0
- 将
com.android.support.test.espresso:espresso-core
替换为androidx.test.espresso:espresso-core:3.1.0
- 仅此而已,但这是所需替换的完整列表
- changed
compileSdkVersion
to28
- replaced
android.support.test.runner.AndroidJUnitRunner
toandroidx.test.runner.AndroidJUnitRunner
- replaced
com.android.support.test:runner
toandroidx.test:runner:1.1.0
- replaced
com.android.support.test.espresso:espresso-core
toandroidx.test.espresso:espresso-core:3.1.0
- in my case that was it, but here's the complete list of required replacements
打开android/gradle/wrapper/gradle-wrapper.properties
并将distributionUrl
更改为https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
(您可能必须使用5.4.1,请参见下面的更新)
执行了flutter clean
这与我的预期相反,确实有效! :)
And contrary to what I expected, IT WORKED! :)
当我使用应用程序签名将应用程序更新为波动性v1.9.1+hotfix.5
时,我陷入了错误SigningConfig "release" is missing required property "storePassword"
的困境,最后,它是上面第7步中的gradle版本.因此,现在我按照5.4.1 noreferrer> Wiki .
When updating my app to flutter v1.9.1+hotfix.5
, as I use app signing, I was stuck with the error SigningConfig "release" is missing required property "storePassword"
and in the end it was the gradle version from step 7 above. So now I'm using 5.4.1 as suggested in this wiki.
[android/gradle/wrapper/gradle-wrapper.properties]
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
这篇关于颤振项目Android X迁移问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!