Reputation: 25
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:
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.
Upvotes: 2
Views: 349
Reputation: 25
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!
Upvotes: 0