Error: Activity class {com.amicomponents/com.amicomponents.MainActivity} does not exist - linux

I'm trying to build react-native project in Android studio but it fails.
BUILD SUCCESSFUL in 4m 31s
72 actionable tasks: 2 executed, 70 up-to-date
info Connecting to the development server...
8081
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.amicomponents/.MainActivity }
Error type 3
Error: Activity class {com.amicomponents/com.amicomponents.MainActivity} does not exist.

Related

Gradle task :app:createDebugAndroidTestCoverageReport fails, why?

When I run gradlew createDebugCoverageReport it fails with:
Task :app:connectedDebugAndroidTest
Starting 1 tests on Tablet_Sv2(AVD) - 12
Test results saved as file:/../app/build/outputs/androidTest-results/connected/flavors/app/Tablet_Sv2(AVD)%20-%2012/test-result.pb. Inspect these results in Android Studio by selecting Run > Import Tests From File from the menu bar and importing test-
result.pb.
Task :app:createDebugAndroidTestCoverageReport FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:createDebugAndroidTestCoverageReport'.
A failure occurred while executing com.android.build.gradle.internal.coverage.JacocoReportTask$JacocoReportWorkerAction
Unable to generate Jacoco report
Why?
EDIT:
According to this Answer the app level build.gradle would require
configurations.all{
resolutionStrategy {
eachDependency { details ->
if ('org.jacoco' == details.requested.group) {
details.useVersion "0.8.7"
}
}
}
}

Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException: No online devices found

When I normally running my react-native from visual code in Android Virtual Device (Emulator) via terminal with npx react-native run android, suddenly I'm facing this error
1. info Running jetifier to migrate libraries to AndroidX. You can
disable it using "--no-jetifier" flag. Jetifier found 954 file(s) to
forward-jetify. Using 8 workers... info Starting JS server... info
Launching emulator... error Failed to launch emulator. Reason: Could
not start emulator within 30 seconds.. warn Please launch an
emulator manually or connect a device. Otherwise app may fail to
launch. info Installing the app...
> Configure project :react-native-firebase_app :react-native-firebase_app package.json found at
C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_app:firebase.bom using default value: 28.1.0
:react-native-firebase_app:play.play-services-auth using default
value: 19.0.0 :react-native-firebase_app package.json found at
C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_app:version set from package.json: 12.1.0
(12,1,0 - 12001000) :react-native-firebase_app:android.compileSdk
using custom value: 29 :react-native-firebase_app:android.targetSdk
using custom value: 29 :react-native-firebase_app:android.minSdk
using custom value: 21
:react-native-firebase_app:reactNativeAndroidDir
C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\react-native\android
> Task :app:installDebug FAILED Skipping device 'emulator-5554' (emulator-5554): Device is OFFLINE. 64 actionable tasks: 2 executed,
62 up-to-date
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* 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 16s
error Failed to install the app. Make sure you have the Android
development environment set up:
https://reactnative.dev/docs/environment-setup. Error: Command
failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* 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 16s
at makeError (C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\execa\index.js:174:9)
at C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async runOnAllDevices (C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.
I don't know if you already fixed this but I just solved it!
I added more space to the Android Virtual Device.
You have to:
Edit the device or create a new one
On the ¨Verify Configuration¨ page, click on ¨Show Advanced Settings¨
Scroll down to ¨Memory and Storage¨
Change the Internal Storage MB amount
Initially the device that I've created had 2048MB and so I changed it to 6000MB but that wasn't enough so I finally put 10000MB of Internal Storage and with that amount I didn't get this error anymore.
Hope it works, good luck!

Running flutter app in vscode and get this error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'

i'm currently facing the problem in running my flutter app in physical device(phone). i'm using android studio 4 and vscode. The error message is below.
Launching lib\main.dart on TECNO B1f in debug mode...
lib\main.dart:1
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to find target with hash string 'android-29' in: C:\Users\Kitsson\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 7m 8s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I would suggest 4 methods to solve this issue , try one after another until it works for you :
Open terminal - run flutter doctor --android-licenses. Just accept all and it should work, if it dosen't then skip to next step.
adding buildToolsVersion in android => app => build.gradle
android { compileSdkVersion 29 buildToolsVersion "29.0.0" ... ... }
This often happens when you have something in your dependency that require internet like firebase. Just turn on your internet or wifi .
If none of them works then turn off developer option and turn it on again by pressing build number 7 times, this will revoke all usb debugging autherisation and ask whether to trust your developing machine , press yes and you will be good to go

Experiencing difficulties running a gatsby project on yarn

I am trying to help a friend with its gatsby template, each time I tried to run the gatsby project, I get several errors.
C:\Users\Thosyn Pax\Desktop\Project\Sarvesh\Sarvesh\Superprops\Superprops>yarn gatsby-dev
yarn run v1.22.4
$ yarn workspace gatsby-landing run dev
$ gatsby develop
success open and validate gatsby-configs - 0.474s
success load plugins - 99.856s
success onPreInit - 0.400s
success initialize cache - 0.175s
success copy gatsby files - 1.584s
success onPreBootstrap - 3.519s
success createSchemaCustomization - 0.129s
success source and transform nodes - 16.371s
success building schema - 13.086s
success createPages - 0.022s
success createPagesStatefully - 2.229s
success onPreExtractQueries - 0.010s
success update schema - 0.379s
success extract queries from components - 39.358s
success write out requires - 0.879s
success write out redirect data - 0.019s
warn The icon(src/images/favicon.png) you provided to 'gatsby-plugin-manifest' is not
square.
The icons we generate will be square and for the best results we recommend you
success Build manifest and related icons - 2.713s
success onPostBootstrap - 2.757s
⠀
info bootstrap finished - 266.442s
⠀
ERROR
Processing C:/Users/Thosyn Pax/Desktop/Project/Sarvesh/Sarvesh/Superprops/Superprops/packages/common/src/assets/image/agency/blog/blog-img1.png failed
Original error:
WorkerError: Processing C:/Users/Thosyn Pax/Desktop/Project/Sarvesh/Sarvesh/Superpr ops/Superprops/packages/common/src/assets/image/agency/blog/blog-img1.png failed
Original error:
- jobs-manager.js:316 exports.enqueueJob
[Superprops]/[gatsby]/dist/utils/jobs-manager.js:316:23
- runMicrotasks
- task_queues.js:97 processTicksAndRejections
internal/process/task_queues.js:97:5
not finished run queries - 2.861s
not finished Generating image thumbnails - 2.512s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: C:\Program Files\nodejs\node.exe
Arguments: C:\Program Files (x86)\Yarn\lib\cli.js run dev
Directory: C:\Users\Thosyn Pax\Desktop\Project\Sarvesh\Sarvesh\Superprops\Superprops\packages\landing-gatsby
Output:
info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. in Mac

I am setting up an Android development environment. However, there is a problem in the execution environment. I've already finished the configuration, but I keep saying I can't find the device. However, if you run the server and then run it in the Android studio, it will work normally. What's the problem?
bash_profile
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
export PATH=${PATH}:$JAVA_HOME/bin
export ANDROID_PATH=/Users/myname/Library/Android
export PATH=$PATH:$ANDROID_PATH/sdk/platform-tools
export PATH=$PATH:$ANDROID_PATH/sdk/emulator
export PATH=$PATH:$ANDROID_PATH/sdk/tools
export PATH=$PATH:$ANDROID_PATH/sdk/tools/bin
But Error
$ npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command 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...
Starting a Gradle Daemon, 5 stopped Daemons could not be reused, use --status for details
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
> Task :app:installDebug
> Task :app:installDebug FAILED
27 actionable tasks: 9 executed, 18 up-to-date
[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 22s
error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
[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 22s
at checkExecSyncError (child_process.js:611:11)
at execFileSync (child_process.js:629:15)
at runOnAllDevices (/Users/myname/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Is there anyone who has the same problem as me?
Try the following:
> vim ~/.bash_profile
Add the following lines:
export ANDROID_HOME=/Users/myname/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_PATH/emulator
export PATH=$PATH:$ANDROID_PATH/tools/bin
Save changes and restart terminal.
Run ADB and if you got following it will work.
> adb devices
List of devices attached
emulator-5554 device
If you already configured the .bash_profile check the ANDROID_HOME using echo and then you simply need to run your app with this command :
source ~/.bash_profile && npx react-native run-android
UPDATE
Pay attention to this : You should run bash shell NOT zsh shell to be able to run emulator.

Resources