Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't find Android studio emulator. #1

Open
maotora opened this issue Jan 15, 2018 · 22 comments
Open

Won't find Android studio emulator. #1

maotora opened this issue Jan 15, 2018 · 22 comments

Comments

@maotora
Copy link

maotora commented Jan 15, 2018

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 error

Scanning 767 folders for symlinks in /home/user/Projects/Phones/react-native-track-player-demo/node_modules (7ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
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/android-setup.html

My emulator is up and other projects can use it and install apps normally.

@moonstruck
Copy link

@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

@maotora
Copy link
Author

maotora commented Feb 8, 2018

@moonstruck Hi.

Thanks for replying.

I tried your method unfortunately still fails.

image

@enero-o
Copy link

enero-o commented Mar 27, 2018

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 ?

@maotora
Copy link
Author

maotora commented Apr 4, 2018

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.

@ithustle
Copy link

@maotora , any thing?

@himankpathak
Copy link

Facing the same issue, any fix yet?

@jitish1
Copy link

jitish1 commented Oct 11, 2018

Hi, this might resolve the issue ---

  1. Just run sudo chmod -R 777 react-native-track-player-demo(Project Name) after that
  2. npm install
  3. react-native link
  4. react-native run android

@maotora
Copy link
Author

maotora commented Oct 12, 2018

I didn't work, sadly.

image

@moonstruck
Copy link

moonstruck commented Oct 12, 2018

This repo is not active for last couple of months.
Try the new example Instead.

@maotora
Copy link
Author

maotora commented Oct 15, 2018

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?

@jitish1
Copy link

jitish1 commented Oct 16, 2018

Hi @maotora
change your version in package.json
"react-native-track-player": "git+https://github.com/rm3rdmodules/react-native-track-player.git#dev",

@maotora
Copy link
Author

maotora commented Oct 17, 2018

Now I feel stupid..

  1. 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.

  2. Ran npm install & react-native link

  3. 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"
  }
}

@moonstruck
Copy link

@maotora Give the dev branch a try.

@maotora
Copy link
Author

maotora commented Oct 23, 2018

@moonstruck that's the only branch I have.

@moonstruck
Copy link

@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

@devt3000
Copy link

Hey, is the dev branch still working?

@aristrisnawan
Copy link

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?

@Samurai97
Copy link

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.

@RichardFisher8410
Copy link

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.

@RanVaknin
Copy link

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.

@JoshuaMcEvoyPalo
Copy link

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 :)

@vaibhavarora14
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests