I am creating an application in flutter and everything was going well, but at the moment it started giving me an error. It won't let me compile and flutter pub upgrade and flutter pub outdated don't work, but flutter pub get if it works fine.
I am new to flutter and I will not understand most of the things they tell me, please, if you can explain me as detailed as possible I would appreciate it
Flutter --no-color build apk
C:\src\flutter\bin\flutter.bat --no-color build apk
Building with sound null safety
Running Gradle task 'assembleRelease'...
/C:/Users/LEO/AppData/Local/Pub/Cache/hosted/pub.dev/google_fonts-2.3.3/lib/src/google_fonts_base.dart:14:1: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.
import 'asset_manifest.dart';
^^^^^^^^^^^^^
/C:/Users/LEO/AppData/Local/Pub/Cache/hosted/pub.dev/google_fonts-2.3.3/lib/src/google_fonts_base.dart:32:31: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.
AssetManifest assetManifest = AssetManifest();
^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1154
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
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 18s
Running Gradle task 'assembleRelease'... 18,8s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1`
Flutter pub upgrade
C:\src\flutter\bin\flutter.bat --no-color pub upgrade Resolving dependencies... Git error. Command: git rev-list --max-count=1 HEAD`
stdout:
stderr: usage: git rev-list [] ... [--] [...]
limiting output:
--max-count=
--max-age=
--min-age=
--sparse
--no-merges
--min-parents=
--no-min-parents
--max-parents=
--no-max-parents
--remove-empty
--all
--branches
--tags
--remotes
--stdin
--exclude-hidden=[receive|uploadpack]
--quiet
ordering output:
--topo-order
--date-order
--reverse
formatting output:
--parents
--children
--objects | --objects-edge
--disk-usage[=human]
--unpacked
--header | --pretty
--[no-]object-names
--abbrev= | --no-abbrev
--abbrev-commit
--left-right
--count
special purpose:
--bisect
--bisect-vars
--bisect-all
exit code: 129
Process finished with exit code 69`
Flutter pub get
C:\src\flutter\bin\flutter.bat --no-color pub get Resolving dependencies... build_runner 2.3.3 (2.4.0 available) cross_file 0.3.3+2 (0.3.3+4 available) flutter_adaptive_scaffold 0.0.9 (0.1.0 available) flutter_facebook_auth 4.4.1+1 (5.0.7 available) flutter_facebook_auth_platform_interface 3.2.0 (4.1.1 available) flutter_facebook_auth_web 3.2.0 (4.1.1 available) flutter_html 3.0.0-alpha.5 (3.0.0-alpha.6 available) flutter_html_audio 3.0.0-alpha.3 (3.0.0-alpha.4 available) flutter_html_svg 3.0.0-alpha.3 (3.0.0-alpha.4 available) flutter_html_table 3.0.0-alpha.3 (3.0.0-alpha.4 available) flutter_html_video 3.0.0-alpha.4 (3.0.0-alpha.5 available) flutter_launcher_icons 0.9.3 (0.11.0 available) flutter_layout_grid 1.0.6 (2.0.1 available) flutter_local_notifications 8.2.0 (13.0.0 available) flutter_local_notifications_platform_interface 4.0.1 (6.0.0 available) flutter_slidable 1.3.2 (2.0.0 available) flutter_svg 1.1.6 (2.0.0+1 available) google_fonts 2.3.3 (4.0.3 available) google_geocoding 0.2.0 (discontinued) google_maps_flutter_web 0.3.3 (0.4.0+5 available) image 3.3.0 (4.0.13 available) intl 0.17.0 (0.18.0 available) json_serializable 6.6.0 (6.6.1 available) mobx 2.1.3 (2.1.3+1 available) numerus 1.1.1 (2.0.0 available) share 2.0.4 (discontinued) shared_preferences_foundation 2.1.2 (2.1.3 available) source_gen 1.2.6 (1.2.7 available) table_calendar 3.0.8 (3.0.9 available) timezone 0.8.0 (0.9.1 available) webview_flutter 3.0.4 (4.0.2 available) webview_flutter_android 2.10.4 (3.2.4 available) webview_flutter_platform_interface 1.9.5 (2.0.1 available) webview_flutter_wkwebview 2.9.5 (3.0.5 available) win32 3.1.3 (4.1.1 available) Got dependencies! Process finished with exit code 0
Flutter doctor
`Windows PowerShell
Copyright (C) Microsoft Corporation. Todos los derechos reservados.
PS C:\Windows\System32\WindowsPowerShell\v1.0> flutter doctor -v
[√] Flutter (Channel master, 3.8.0-3.0.pre.22, on Microsoft Windows [Versi¢n 10.0.17763.107], locale es-CU)
• Flutter version 3.8.0-3.0.pre.22 on channel master at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 69421c1 (34 hours ago), 2023-02-02 23:28:57 -0800
• Engine revision e3fe6dade9
• Dart version 3.0.0 (build 3.0.0-198.0.dev)
• DevTools version 2.21.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\src\Sdk
• Platform android-33-ext4, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2022 17.4.4)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
• Visual Studio Build Tools 2022 version 17.4.33213.308
• Windows 10 SDK version 10.0.20348.0
[√] Android Studio (version 2021.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[√] Connected device (2 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Versi¢n 10.0.17763.107]
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.120
! Device 9888d9463636504450 is offline.
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
PS C:\Windows\System32\WindowsPowerShell\v1.0>`
I tried flutter clean, pub get, I tried in another project and everything is fine, the error is in this one only
This error message indicates that there is a naming conflict with the import of AssetManifest class in your code. It looks like you have imported the AssetManifest class from both package:flutter/src/services/asset_manifest.dart and package:google_fonts/src/asset_manifest.dart which are conflicting with each other.
To fix this issue, you can specify the import path with an alias to differentiate between the two imports like this:
import 'package:flutter/src/services/asset_manifest.dart' as flutter_asset;
import 'package:google_fonts/src/asset_manifest.dart' as google_fonts_asset;
Then, you can use the aliases to access the AssetManifest class like this:
flutter_asset.AssetManifest
google_fonts_asset.AssetManifest
Alternatively, if you only need to use one of the AssetManifest classes, you can remove the import of the other class to avoid the conflict.
I'm new to react native and trying to install it and facing this problems, I've tried many fixes but they don't work.
full error- npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 936 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
/bin/sh: 1: adb: not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Configure project :app
Unable to detect AGP versions for included builds. All projects in the build should use the same AGP version. Class name for the included build object: org.gradle.composite.internal.DefaultIncludedBuild$IncludedBuildImpl_Decorated.
This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}api-level>
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}api-level>
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}vendor>,<{}codename>,<{}abi>,<{}api-level>,<{}tag>
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}vendor>,<{}codename>,<{}abi>,<{}api-level>,<{}tag>
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}vendor>,<{}codename>,<{}abi>,<{}api-level>,<{}tag>
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
Errors limit exceeded. To receive all errors set com.sun.xml.bind logger to FINEST level.
unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}api-level>
Checking the license for package Android SDK Tools in /home/t/Android/Sdk/licenses
License for package Android SDK Tools accepted.
Preparing "Install Android SDK Tools (revision: 26.1.1)".
"Install Android SDK Tools (revision: 26.1.1)" ready.
Installing Android SDK Tools in /home/tannu/Android/Sdk/tools
"Install Android SDK Tools (revision: 26.1.1)" complete.
"Install Android SDK Tools (revision: 26.1.1)" finished.
Checking the license for package Android SDK Build-Tools 30.0.2 in /home/tannu/Android/Sdk/licenses
License for package Android SDK Build-Tools 30.0.2 accepted.
Preparing "Install Android SDK Build-Tools 30.0.2 (revision: 30.0.2)".
"Install Android SDK Build-Tools 30.0.2 (revision: 30.0.2)" ready.
Installing Android SDK Build-Tools 30.0.2 in /home/t/Android/Sdk/build-tools/30.0.2
"Install Android SDK Build-Tools 30.0.2 (revision: 30.0.2)" complete.
"Install Android SDK Build-Tools 30.0.2 (revision: 30.0.2)" finished.
Checking the license for package Android SDK Platform 31 in /home/t/Android/Sdk/licenses
License for package Android SDK Platform 31 accepted.
Preparing "Install Android SDK Platform 31 (revision: 1)".
"Install Android SDK Platform 31 (revision: 1)" ready.
Installing Android SDK Platform 31 in /home/t/Android/Sdk/platforms/android-31
"Install Android SDK Platform 31 (revision: 1)" complete.
"Install Android SDK Platform 31 (revision: 1)" finished.
> Task :app:compileDebugJavaWithJavac
> Task :app:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are: libbutter.so, libc++_shared.so, libevent-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libfabricjni.so, libfb.so, libfbjni.so, libflipper.so, libfolly_futures.so, libfolly_json.so, libglog.so, libglog_init.so, libimagepipeline.so, libjsc.so, libjscexecutor.so, libjsi.so, libjsijniprofiler.so, libjsinspector.so, liblogger.so, libmapbufferjni.so, libnative-filters.so, libnative-imagetranscoder.so, libreact_codegen_rncore.so, libreact_config.so, libreact_debug.so, libreact_nativemodule_core.so, libreact_render_animations.so, libreact_render_attributedstring.so, libreact_render_componentregistry.so, libreact_render_core.so, libreact_render_debug.so, libreact_render_graphics.so, libreact_render_imagemanager.so, libreact_render_leakchecker.so, libreact_render_mapbuffer.so, libreact_render_mounting.so, libreact_render_runtimescheduler.so, libreact_render_scheduler.so, libreact_render_telemetry.so, libreact_render_templateprocessor.so, libreact_render_textlayoutmanager.so, libreact_render_uimanager.so, libreact_utils.so, libreactnativeblob.so, libreactnativejni.so, libreactnativeutilsjni.so, libreactperfloggerjni.so, librrc_image.so, librrc_root.so, librrc_text.so, librrc_unimplementedview.so, librrc_view.so, libruntimeexecutor.so, libturbomodulejsijni.so, libyoga.so.
> Task :app:installDebug
> Task :app:installDebug FAILED
37 actionable tasks: 31 executed, 6 up-to-date
Note: /home/t/quizApp/android/app/src/debug/java/com/quizapp/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[adb]: * daemon not running; starting now at tcp:5037
[adb]: * daemon started successfully
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 3m 13s
error Failed to install the app. Make sure you have an Android emulator running or a device connected.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: /home/t/quizApp/android/app/src/debug/java/com/quizapp/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[adb]: * daemon not running; starting now at tcp:5037
[adb]: * daemon started successfully
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 3m 13s
at makeError (/home/tannu/quizApp/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /home/t/quizApp/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/home/tannu/quizApp/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/home/t/quizApp/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
when build android app using ionic ionic cordova build android comment getting an error
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=...\AppData\Local\Android\Sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information
ionic cordova build android
ionic cordova build android
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=...\AppData\Local\Android\Sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
As of Cordova-Android 6.4.0, Gradle is now required to be installed to build Android.
When installing on Windows, you need to add Gradle to your path, (see
Setting Environment Variables)
I just got a react native project and I am trying to run it. When I run:
react-native run-android
, this is my output.
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Checking the license for package Android SDK Platform 27 in C:\Users\oriont\AppData\Local\Android\Sdk\licenses
Warning: License for package Android SDK Platform 27 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-27 Android SDK Platform 27
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\oriont\AppData\Local\Android\Sdk
* 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 1s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:637:11)
at Object.execFileSync (child_process.js:655:13)
at runOnAllDevices (C:\Users\oriont\dev\proj\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (C:\Users\oriont\dev\proj\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (C:\Users\oriont\dev\proj\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
I have followed all of the directions on the facebook getting started page, but this error keeps popping up. When I run it, I have my AVD running, which is on Android 9. From there, I tried to accept the licenses.
C:\Users\oriont\AppData\Local\Android\Sdk\tools\bin>sdkmanager.bat --licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 5 more
And I don't know what to do from here. I tried expo and it was another rabbit hole... Someone please help! Thanks!
Android Studio > Preferences > Appearance & Behavior > System Settings > Android SDK
Tick the latest Android versions, click Apply.
It's at this point where Android will ask you to agree to its license(s) and the updated version(s) will be installed.
From Here GitHub
I read an answer (Thank you) but it sadly didn't work. I now think that the licenses aren't the problem anymore. I had realized that the project wanted android 27 and I had android 28 installed, so I tried downgrading to android 27. That didn't work, so I just upgraded (I think) the project to android 28 by changing ext in android/build.gradle to:
ext {
buildToolsVersion = "28.0.0"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 26
supportLibVersion = "28.0.0"
}
and add this to android in android/app/build.gradle
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libjsc.so'
pickFirst 'lib/arm64-v8a/libjsc.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
I also had java 10.0.2 installed and I downgraded to java 8. (not sure if that made a difference)
Anyways I hope this helps people get their old projects up to date!
I'm trying to install react-native-camera. I'm on Ubuntu 18, Webstorm for IDE. Targeting Android.
For the Android SDK, I don't have a full Android Studio install. I've instead install only android-sdk and I'm using the sdkmanager. That works fine with my stub app, it compile and runs on Android with
react-native run-android
I've installed react-native-camera as a module with npm as per the indications:
npm install react-native-camera --save
react-native link react-native-camera
So far so good. It links. If I try to launch the app however (even before trying to actually use the camera), I get some warnings:
> Configure project :react-native-camera
Checking the license for package Android SDK Platform-Tools in /usr/lib/android-sdk/licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools (revision: 28.0.1)".
Warning: Failed to read or create install properties file.
WARNING: platform-tools package is not installed, and automatic installation failed.
So I've tried to install the platforms tools using the sdk manager & instructions provided here:
sdkmanager "platform-tools" "platforms;android-28"
Which yields:
Warning: Failed to read or create install properties file.
So I am guessing it really has to do with the sdkmanager...
Do I absolutely need 28.0.1 for react-native-camera? If so, how can I get around this issue with the SDK manager? I've tried various similar syntax for the install of the platform and it didn't work. I checked with sdkmanager --list that it's the proper name (seems to be). And if I go under android-sdk/platforms-tools all I see there is the adb file (or perhaps the install is supposed to just update that file?)
Silly me.
I needed to run the SDK manager as sudo. To do that:
sudo bash sdkmanager [installations args as per post above].
I will leave the post - I lost a ridiculous amount of time for that, hopefully it can help others....
And yes - if the platform-tools install has worked then under /platform-tools you should see a bunch of files, not just the adb one.