When I run the command flutter build apk --release then i face the following issue with auto_orientation.
In my pubspec.yaml file I have the latest version included auto_orientation: ^1.0.5.
Btw. when I run the project with flutter run everything works fine.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':auto_orientation:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/johannes/flutter_projects/udare/app/build/auto_orientation/intermediates/res/merged/release/values/values.xml:236: error: resource android:attr/fontVariationSettings not found.
/Users/johannes/flutter_projects/udare/app/build/auto_orientation/intermediates/res/merged/release/values/values.xml:237: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Flutter doctor:
[✓] Flutter (Channel master, v1.12.15-pre.29, on Mac OS X 10.14.6 18G95, locale
en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.4)
[✓] VS Code (version 1.40.2)
[✓] Connected device (1 available)
• No issues found!
#GreenTigerEye, this could be due to AndroidX incompatibility. You could try directly using the source code of auto_orientation package or try few options mentioned here for a similar issue.
Related
Fail log
gw assembleDebug --scan
> Task :app:checkDebugDuplicateClasses FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class io.flutter.plugins.GeneratedPluginRegistrant found in modules flutter_debug-1.0-runtime (com.example.a.library_a:flutter_debug:1.0) and flutter_debug-2.0-runtime (com.example.b.library_b:flutter_debug:2.0)
Go to the documentation to learn how to Fix dependency resolution errors.
Steps to reproduce;
flutter create -t module --org com.example.a library_a
cd library_a
flutter pub add android_intent_plus
flutter build aar
cd ..
flutter create -t module --org com.example.b library_b
cd library_a
flutter pub add android_intent_plus
// Open pubspec.yaml and change android_intent_plus to 1.0.1
flutter build aar --build-number=2.0
Add both library_a and library_b to an android project. (I tested with a new project)
Build fails with duplicate class.
flutter doctor;
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.10, on macOS 12.5.1 21G83 darwin-arm, locale en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[!] Android Studio
✗ Unable to find bundled Java version.
[!] Android Studio
✗ Unable to find bundled Java version.
[!] Android Studio
✗ Unable to find bundled Java version.
[✓] Android Studio (version 2021.3)
[!] Android Studio
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
[✓] VS Code (version 1.74.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
I'm unable to run my android emulator. I have already checked flutter doctor in cmd and no issues has been found.
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.10.4, on Microsoft Windows [Version 10.0.22000.556], locale en-MY)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.3)
[√] Android Studio (version 2021.1)
[√] VS Code (version 1.66.1)
[√] Connected device (4 available)
[√] HTTP Host Availability
• No issues found!
However, it shows built failed with an exception as below
Launching lib\main.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
AAPT: error: failed to open APK: Invalid file.
When I am trying to run my flutter app in Android emulator it throws this exception:
Launching lib/main.dart on sdk gphone x86 in debug mode...
lib/main.dart:1
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/Users/divyesh12/Documents/Development /GitRepos/Shopapp_flutter/myshop_app/build/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:23: AAPT: error: unexpected element <uses-permission> found in <manifest><application>.
flutter doctor result:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on Mac OS X 10.15.6 19G73 darwin-x64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.57.1)
[✓] Connected device (2 available)
• No issues found!
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myste_app">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
Note: It works fine in iOS, how to fix this?
You maybe adding the permission in the wrong xml file.
You should be editing the xml file in this path to add permissions:
\android\app\src\main\AndroidManifest.xml
My app starts but then stops because of the error. I am using Windows 10, android studio as an IDE, and trying to build an android app.
if I use a terminal outside of Android studio it works, so it should be android studio related.
console:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
Error connecting to the service protocol: Exception: Attempted to connect to
Dart observatory 5 times, and all attempts failed. Giving up. The URL was
ws://127.0.0.1:50997/ws
flutter Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version
10.0.16299.847], locale de-DE)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
X Android license status unknown.
[√] Android Studio (version 3.2)
[√] Connected device (1 available)
! Doctor found issues in 1 category.
If you have configured a proxy,
ensure you have also set the environment variable
NO_PROXY=127.0.0.1
I can't build on iOS Simulator when using firebase_admob Plugin.
I can build on Android.
console log:
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/rkowase/StudioProjects/stopwatch/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'firebase_admob/FirebaseAdMobPlugin.h' file not found
#import <firebase_admob/FirebaseAdMobPlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.
flutter doctor
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.12.6 16G1114, locale en-JP)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.0)
[✓] Connected devices (2 available)
• No issues found!
pubspec.yaml
dependencies:
flutter:
sdk: flutter
firebase_admob:
I use firebase_admob v0.5.0
https://pub.dartlang.org/packages/firebase_admob
Sample code
https://github.com/rkowase/flutter-firebase-admob-sample
I solved it by doing this workaround.
Links
"Made Podfiles use symlinks to local pods" not working · Issue #15099 · flutter/flutter
https://github.com/flutter/flutter/issues/15099
objective c - Swift compiler error: "non-modular header inside framework module" - Stack Overflow
Swift compiler error: "non-modular header inside framework module"
PathProvider not found on iOS build - Google Groups
https://groups.google.com/forum/#!msg/flutter-dev/7QRk1RphLDE/5rLS4CciBwAJ