Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.

[Android] last git version won't install or compile #332

Closed
2 of 4 tasks
rborn opened this issue Jun 9, 2020 · 7 comments
Closed
2 of 4 tasks

[Android] last git version won't install or compile #332

rborn opened this issue Jun 9, 2020 · 7 comments

Comments

@rborn
Copy link
Contributor

rborn commented Jun 9, 2020

Description

  1. Sample code (provide repo url or sample code)
    Hi everyone,
    I'm trying to use the git version but I'm hitting a wall.

A simple npm install git://github.com/tanguyantoine/react-native-music-control.git will give me some tsc errors

(letsemjoyapp)--(bugfix/musiccontrolupdate*)==>
$ npm install git://github.com/tanguyantoine/react-native-music-control.git

> [email protected] prepack /tmp/bundle/vendor/.npm/_cacache/tmp/git-clone-6e78f400
> tsc -p tsconfig.json

src/constants.android.ts:1:31 - error TS2307: Cannot find module 'react-native' or its corresponding type declarations.

1 import { NativeModules } from 'react-native'
                                ~~~~~~~~~~~~~~

And if I try to install ignoring the scripts, it won't compile

/Work/clients/current/emjoy/app/letsemjoyapp/node_modules/react-native-music-control/android/src/main/java/com/tanguyantoine/react/MusicControlNotification.java:189: error: cannot find symbol
            notification = MusicControlModule.INSTANCE.notification.prepareNotification(MusicControlModule.INSTANCE.nb, false);
            ^
  symbol:   variable notification
  location: class NotificationService
/Work/clients/current/emjoy/app/letsemjoyapp/node_modules/react-native-music-control/android/src/main/java/com/tanguyantoine/react/MusicControlNotification.java:190: error: cannot find symbol
            startForeground(NOTIFICATION_ID, notification);
                                             ^
  symbol:   variable notification
  location: class NotificationService
/Work/clients/current/emjoy/app/letsemjoyapp/node_modules/react-native-music-control/android/src/main/java/com/tanguyantoine/react/MusicControlNotification.java:191: error: cannot find symbol
            isRunning = true;
            ^
  symbol:   variable isRunning
  location: class NotificationService
Note: /Work/clients/current/emjoy/app/letsemjoyapp/node_modules/react-native-music-control/android/src/main/java/com/tanguyantoine/react/MusicControlAudioFocusListener.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors

  1. Platform ?

    • iOS
    • Android
  1. Device
  • Simulator
  • Real device

Thank you!

@bradfloodx
Copy link
Collaborator

bradfloodx commented Jun 10, 2020

Hi @rborn this is likely due to the NPM build/publishing process. You'll need to install via NPM as per the instructions. But if you can't do that then you could copy the NPM folder and upload it to your own fork or something.
Cheers
Brad

@rborn
Copy link
Contributor Author

rborn commented Jun 10, 2020

Hi @bradleyflood, thanks for replying. I am trying to fix it in my fork but please reopen the issue as it doesn't compile and there are errors in the java code (on it, will open a PR as soon as I have it solved)

@bradfloodx
Copy link
Collaborator

Hi @rborn take a look at this commit here in my dev fork.
bradfloodx@713208b

These are the files that are generated when running the build commands. These are the files you are missing.
At the very bottom of the above commit you will see the package.json build commands. You can either run those or just copy the files from the commit above.

Why not just use NPM?

@rborn
Copy link
Contributor Author

rborn commented Jun 10, 2020

The missing files are for typescript, which is fine, I can leave without them :) but there are errors in java and won't compile.

And the npm version is 4 months old, not the current one, is not yet published 😄 https://www.npmjs.com/package/react-native-music-control

@bradfloodx
Copy link
Collaborator

Haha ok awesome you understand this situation better than I do. Let's re-open it and look into it.

Sorry my bad!

@bradfloodx bradfloodx reopened this Jun 10, 2020
@rborn
Copy link
Contributor Author

rborn commented Jun 10, 2020

@bradleyflood ok, PR done

It is a mix between other commits and this fix

  • added missing libs so install from git works (typescript)
  • uses a commit from somebody else that adds a check for abandonFocus
  • fixes the undefined compile issue
  • removes an unused isRunning var

I installed from my fork and compiled the app, all works :)

@bradfloodx
Copy link
Collaborator

Thanks @rborn merged and released in 0.12.0

Good job mate!

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

No branches or pull requests

2 participants