Skip to content

Won't find Android studio emulator. #1

Open

Description

@maotora

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.

Activity

  1. moonstruck commented on Feb 4, 2018

    @moonstruck

    @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

  2. maotora commented on Feb 8, 2018

    @maotora
    Author

    @moonstruck Hi.

    Thanks for replying.

    I tried your method unfortunately still fails.

    image

  3. enero-o commented on Mar 27, 2018

    @enero-o

    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 ?

  4. maotora commented on Apr 4, 2018

    @maotora
    Author

    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.

  5. ithustle commented on Aug 23, 2018

    @ithustle

    @maotora , any thing?

  6. himankpathak commented on Aug 23, 2018

    @himankpathak

    Facing the same issue, any fix yet?

  7. jitish1 commented on Oct 11, 2018

    @jitish1

    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
  8. maotora commented on Oct 12, 2018

    @maotora
    Author

    I didn't work, sadly.

    image

  9. moonstruck commented on Oct 12, 2018

    @moonstruck

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

  10. maotora commented on Oct 15, 2018

    @maotora
    Author

    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?

  11. jitish1 commented on Oct 16, 2018

    @jitish1

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

  12. maotora commented on Oct 17, 2018

    @maotora
    Author

    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"
      }
    }
  13. moonstruck commented on Oct 21, 2018

    @moonstruck

    @maotora Give the dev branch a try.

  14. maotora commented on Oct 23, 2018

    @maotora
    Author

    @moonstruck that's the only branch I have.

  15. moonstruck commented on Oct 23, 2018

    @moonstruck

    @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

  16. devt3000 commented on Apr 26, 2019

    @devt3000

    Hey, is the dev branch still working?

  17. aristrisnawan commented on Nov 12, 2019

    @aristrisnawan

    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?

  18. Samurai97 commented on Nov 28, 2019

    @Samurai97

    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.

  19. RichardFisher8410 commented on Apr 1, 2020

    @RichardFisher8410

    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.

  20. RanVaknin commented on May 15, 2020

    @RanVaknin

    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.

  21. JoshuaMcEvoyPalo commented on May 21, 2020

    @JoshuaMcEvoyPalo

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

  22. vaibhavarora14 commented on Nov 19, 2020

    @vaibhavarora14

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions