Open maotora opened 6 years ago
@maotora You may specify which emulator to run on like ..
react-native run-android --deviceId emulator-5554
To get list of emulators run
adb devices -l
@moonstruck Hi.
Thanks for replying.
I tried your method unfortunately still fails.
The problem is not that it cant find the Android Emulator, There's an error in compiling your projects, have you linked your dependencies well ?
Hi @aivene25 , Thank you for your response but it still doesn't work.
I re-cloned the project, then ran yarn
then react-native link
then ran yarn
again then npm run start
and lastly react-native run android
still same issue.
@maotora , any thing?
Facing the same issue, any fix yet?
Hi, this might resolve the issue ---
I didn't work, sadly.
This repo is not active for last couple of months. Try the new example Instead.
Hello @moonstruck ,
I tried your solution and it gave a different error.
⚠️ long stacktrace ahead.
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:4: error: cannot find symbol
import android.app.NotificationChannel;
^
symbol: class NotificationChannel
location: package android.app
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:20: error: package android.support.v4.media.app.NotificationCompat does not exist
import android.support.v4.media.app.NotificationCompat.MediaStyle;
^
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:42: error: cannot find symbol
private MediaStyle style;
^
symbol: class MediaStyle
location: class MediaNotification
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:82: error: cannot find symbol
@RequiresApi(VERSION_CODES.O)
^
symbol: variable O
location: class VERSION_CODES
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:56: error: cannot find symbol
if(VERSION.SDK_INT >= VERSION_CODES.O) createChannel();
^
symbol: variable O
location: class VERSION_CODES
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:58: error: constructor Builder in class Builder cannot be applied to given types;
this.nb = new Builder(context, "trackplayer");
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:59: error: cannot find symbol
this.style = new MediaStyle().setMediaSession(session.getSessionToken());
^
symbol: class MediaStyle
location: class MediaNotification
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:86: error: cannot find symbol
NotificationChannel channel = new NotificationChannel("trackplayer", "Media controls", NotificationManager.IMPORTANCE_LOW);
^
symbol: class NotificationChannel
location: class MediaNotification
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:86: error: cannot find symbol
NotificationChannel channel = new NotificationChannel("trackplayer", "Media controls", NotificationManager.IMPORTANCE_LOW);
^
symbol: class NotificationChannel
location: class MediaNotification
/home/user/Projects/demo/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:86: error: cannot find symbol
NotificationChannel channel = new NotificationChannel("trackplayer", "Media controls", NotificationManager.IMPORTANCE_LOW);
^
symbol: variable IMPORTANCE_LOW
location: class NotificationManager
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
10 errors
:react-native-track-player:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-track-player:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.011 secs
Could not install the app on the device, read the error above for details.
I can see some light in this, do you have any solutions to this issue?
Hi @maotora
change your version in package.json
"react-native-track-player": "git+https://github.com/rm3rdmodules/react-native-track-player.git#dev",
Now I feel stupid..
Changed the "react-native-track-player" to "git+https://github.com/rm3rdmodules/react-native-track-player.git#dev" and "version" to "0.0.2" in package.json.
Ran npm install
& react-native link
Ran react-native run-android
Gets a different error.
Scanning folders for symlinks in /home/user/Projects/demo/react-native-track-player/example/node_modules (7ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-track-player'.
> Could not resolve all dependencies for configuration ':react-native-track-player:_debugPublishCopy'.
> Could not find com.android.support:support-annotations:26.1.0.
Searched in the following locations:
file:/home/user/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.pom
file:/home/user/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.jar
file:/home/user/Projects/demo/react-native-track-player/example/android/sdk-manager/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.jar
Required by:
example:react-native-track-player:unspecified > com.android.support:support-media-compat:26.1.0
example:react-native-track-player:unspecified > com.android.support:support-media-compat:26.1.0 > com.android.support:support-compat:26.1.0
> Could not find android.arch.lifecycle:runtime:1.0.0.
Searched in the following locations:
file:/home/user/Android/Sdk/extras/android/m2repository/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.pom
file:/home/user/Android/Sdk/extras/android/m2repository/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar
file:/home/user/Projects/demo/react-native-track-player/example/android/sdk-manager/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar
Required by:
example:react-native-track-player:unspecified > com.android.support:support-media-compat:26.1.0 > com.android.support:support-compat:26.1.0
> Could not find com.android.support:support-annotations:26.1.0.
Searched in the following locations:
file:/home/user/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.pom
file:/home/user/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.jar
file:/home/user/Projects/demo/react-native-track-player/example/android/sdk-manager/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.jar
Required by:
example:react-native-track-player:unspecified > com.android.support:appcompat-v7:23.2.0 > com.android.support:support-v4:23.2.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 11.981 secs
Package.json file
{
"name": "example",
"version": "0.0.2",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"mobx": "^4.1.1",
"mobx-react": "^5.0.0",
"react": "^16.3.0-alpha.0",
"react-native": "0.55.0",
"react-native-track-player": "git+https://github.com/rm3rdmodules/react-native-track-player.git#dev",
"react-navigation": "^1.5.9"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react-native": "^4.0.0",
"jest": "22.4.3",
"react-test-renderer": "^16.3.0-alpha.0"
},
"jest": {
"preset": "react-native"
}
}
@maotora Give the dev branch a try.
@moonstruck that's the only branch I have.
@maotora Open emulator and try this git clone https://github.com/react-native-kit/react-native-track-player.git git checkout dev cd example yarn install react-native run-android
Hey, is the dev branch still working?
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 959 file(s) to forward-jetify. Using 2 workers...
info Starting JS server...
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...
every run my project always appear error like that do you can handle my problem?
I found that specifically adding the emulator path (and in fact the platform-tools) folders to my PATH environment variable, those issues go away. Why it doesn't append to the ANDROID_SDK_ROOT environment variable in Windows I'm not sure.
Hi Guys, if anyone still has this issue. An easy fix is just to open the 'android' folder from your react-native project in android studio and build directly from there. None of the other solutions above worked for me. however this worked straight away.
Hi Guys, if anyone still has this issue. An easy fix is just to open the 'android' folder from your react-native project in android studio and build directly from there. None of the other solutions above worked for me. however this worked straight away.
where did you build? I dont have a build button when I go into Android studio -> Android folder.
Hi Guys, if anyone still has this issue. An easy fix is just to open the 'android' folder from your react-native project in android studio and build directly from there. None of the other solutions above worked for me. however this worked straight away.
where did you build? I dont have a build button when I go into Android studio -> Android folder.
Make sure you're opening the build.gradle
file found in the /android
directory in your react-native app folder when opening in Android Studio. Then you should be able to press the green 'play' button at the top of Android Studio. If this doesn't work make sure you've opened the emulator first and have it selected in the dropdown menu next to the 'play' button. Hope this helps :)
Flutter is able to detect open emulator, but react-native is not able to. Facing same issue as others are facing it here. What's the final call for resolution?
Hi,
am running your app on an android studio emulator and it looks like this demo can't find it!
Whenever I run
react-native run-android
it gives errorMy emulator is up and other projects can use it and install apps normally.