[英]Migration from Android v1 to V2
大家好,我对 Flutter 还是很陌生,我遇到了这个问题。
我的应用程序显然是 V2,但 Android 工作室仍然表示必须迁移该应用程序。
我做了他们建议的步骤,但仍然得到相同的结果谁能建议我做错了什么? 这是我必须做的链接: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
这是我修改的。
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ipill">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.androidtutorialpoint.mymapsappsdirection.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application
android:name="${ipill}"
android:label="ipill"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<!-- Specify that the launch screen should continue being displayed -->
<!-- until Flutter renders its first frame. -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value=""/>
</application>
</manifest>
并且文件 MainActivity.kt 包含以下内容
package com.example.ipill
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
我也尝试使用 flutter install --ignore-deprecation 标志,但他们说它不起作用。
任何帮助,因为我迷路了,我真的需要让应用程序工作,我发现了一个类似的问题,我应用了他们的建议,但它没有用。
这是我得到的日志
FAILURE: Build failed with an exception.
D:\7_GitHub\Piller2.0\android\app\src\main\AndroidManifest.xml:18:9-32 Error:
Attribute application@name at AndroidManifest.xml:18:9-32 requires a placeholder substitution but no value for <ipill> is provided.
D:\7_GitHub\Piller2.0\android\app\src\debug\AndroidManifest.xml Error:
Validation failed, exiting
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
Exception: Gradle task assembleDebug failed with exit code 1
我可以通过设置android:name
来解决这个问题
android:name="${applicationName}"
在android/app/src/main/AndroidManifest.xml
显然,即使您已经升级到 V2 嵌入,Flutter 2.10 的检查也比以前的版本更严格。
在您的 main/xml 文件中,将android:name
更改为android:name="${applicationName}
官方文档可以参考https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.