Skip to content

Incorrect package generated by cli.js #714

@patrice4github

Description

@patrice4github

Environment

info Fetching system and libraries information...
System:
    OS: macOS 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
    Memory: 95.32 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.8.0 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 26, 28, 29
      Build Tools: 28.0.2, 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    create-react-native-app: 1.0.0
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

Description

When I run: node ./node_modules/react-native/cli.js config I get the following output, see attached output (zipped json). See the incorrect snippet:

"android":{
   "sourceDir":"/Users/patricegagnon/_projects/my_test_spotify/node_modules/rn-spotify-sdk/android",
   "folder":"/Users/patricegagnon/_projects/my_test_spotify/node_modules/rn-spotify-sdk",
71 "packageImportPath":"import com.spotify.sdk.android.authentication.RNSpotifyPackage;",
   "packageInstance":"new RNSpotifyPackage()"
}

reactNativeConfigOutput.json.zip

At line 71, the package should be com.lufinkey.react.spotify.RNSpotifyPackage
instead of: com.spotify.sdk.android.authentication.RNSpotifyPackage

as described HERE. This incorrect package used land in MainApplication.java where we could change it. Now it lands in the generated PackageList.java which I can't overwrite.

To reproduce:

Either:

git clone https://github.com/patrice4github/test_spotify.git
npm install
react-native run-android

This is an empty application created with:

react-native init test_spotify
npm install react-native-events --save
npm install rn-spotify-sdk --save
Configured as described on the react-native-spotify readme

The error is this:

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/pg/_projects/my_test_spotify/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:19: error: cannot find symbol
import com.spotify.sdk.android.authentication.RNSpotifyPackage;
                                             ^
  symbol:   class RNSpotifyPackage
  location: package com.spotify.sdk.android.authentication
/Users/pg/_projects/my_test_spotify/android/app/src/main/java/com/my_test_spotify/PackageList.java:44: error: getApplication() has protected access in ReactNativeHost
    return this.reactNativeHost.getApplication();
                               ^
/Users/pg/_projects/my_test_spotify/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:54: error: cannot find symbol
      new RNSpotifyPackage()

Expected Results:

I'm not sure where this com.spotify.sdk.android,authentication package comes from. Neither, I don't know what cli.js runs. I'll gladly submit a PR if anyone can direct me in the direction where to look.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions