Reputation: 356
I have created a flutter app for which I want to implement a home screen widget. For a first try, I am following this tutorial: https://medium.com/@ashishgarg1998/how-to-create-home-screen-app-widgets-in-flutter-ce3458f3638e
After copying the code snippets, the following exception is thrown on build:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
/Users/me/Documents/MyApp/myapp/android/app/src/main/AndroidManifest.xml:41:13-42:55: AAPT: error: resource xml/widget_info (aka de.myapp.myapp:xml/widget_info) not found.
The error-causing code within the AndroidManifest.xml is:
<receiver android:name="AppWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_info" />
</receiver>
Apparently, the widget_info.xml file cannot be located. I have tried to just use the full file path but the compiler will only let me use the @xml/... notation. How can I fix this? Sidenote: I don't have any Android/Kotlin experience, only Flutter.
Below, you can see my file structure:
Upvotes: 2
Views: 2022
Reputation: 356
I actually found the solution myself by now. The AndroidManifest.xml file is looking for the @xml resource in the
android/app/src/main/res
folder and not the
android/app/res
folder as the tutorial suggests. So moving the widget_info.xml file did the trick.
Upvotes: 4