如何添加' in' Flutter应用程序的域以避免Android资源链接错误?
我正在使用cmd:
flutter create --org in.fiesto lafiesto
此命令将“在backticks-” in the mainActivity.kt文件中进行“ flutter”项目进行,因为“ in”是关键字。
当我运行该应用程序时,会引发以下错误:
- 出了什么问题: 执行失败的任务':app:processDebugresources'。
执行com.android.build.gradle.internal.res.linkapplicationand androidResourCestask $ taskAction $ taskAction
发生故障 Android资源链接失败 错误:/home/abhi/documents/fiesto/lafiesto/build/app/app/intermediates/packaged_manifests/debug/androidmanifest.xml:2:aapt:aapt:aapt:apt:atribute:attribute'package in tag `.fiesto.lafiesto'。
此软件包名称/.../ androidmanifest.xml文件: package =“ in.fiesto.lafiesto”
mainActivity.kt的内容为:
package `in`.fiesto.lafiesto
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
和android> src> AndroidManifest.xml文件具有:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.fiesto.lafiesto">
<application
android:label="lafiesto"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
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"
/>
<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" />
</application>
</manifest>
android debug androidManifest.xml文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.fiesto.lafiesto">
<application
android:label="lafiesto"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
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"
/>
<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" />
</application>
</manifest>
我尝试更改Minsdk,targetsdk,compilesdk和build.gradle文件中的其他内容,并尝试更改“ package = in.fiesto.lafiesto”, in..fiesto.lafiesto” in androidManifest.xml文件中,但没有任何效果。 请建议如何解决这个问题。
I'm making a flutter project with the cmd:
flutter create --org in.fiesto lafiesto
This command puts 'in' under backticks- `in` in the MainActivity.kt file because 'in' is a keyword.
When I run the app it throws the following error:
- What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Android resource linking failed
ERROR:/home/abhi/Documents/Fiesto/lafiesto/build/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:2: AAPT: error: attribute 'package' in tag is not a valid Android package name: '`in`.fiesto.lafiesto'.
This package name in the build/.../AndroidManifest.xml file:
package="`in`.fiesto.lafiesto"
The contents of MAinActivity.kt are:
package `in`.fiesto.lafiesto
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
And the android>src> AndroidManifest.xml file has:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.fiesto.lafiesto">
<application
android:label="lafiesto"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
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"
/>
<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" />
</application>
</manifest>
The android>debug AndroidManifest.xml file has:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.fiesto.lafiesto">
<application
android:label="lafiesto"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
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"
/>
<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" />
</application>
</manifest>
I tried changing minSdk, targetSdk, compileSdk and other things in build.gradle file and also tried changing "package=in.fiesto.lafiesto" to "package=`in`.fiesto.lafiesto" in AndroidManifest.xml files but nothing worked.
Please suggest how to deal with this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Flutter创建-i objc -a java -org in.fiesto lafiesto解决了问题。它在Android&Gt; src&gt; Main下创建了一个Java文件夹,该文件夹具有两个名为“”和“ IO”的文件夹,没有Kotlin文件夹。我不知道这是否会有任何缺点!
flutter create -i objc -a java --org in.fiesto lafiesto solved the problem. It created a Java folder under android>src>main which has two folders named "in" and "io", there's no kotlin folder. I don't know if this will have any drawbacks or not!