cawfree / react-native-quiet

🤫 Quiet for React Native.
173 stars 21 forks source link

Wrong package name in the generated PackageList.java #7

Closed nhuttrung closed 4 years ago

nhuttrung commented 4 years ago

I follow the instruction to setup the project.

The generated /android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:

package com.facebook.react;
...
// react-native-quiet
import org.quietmodem.Quiet.RNQuietPackage;      // 🡒 wrong package name here?

public class PackageList {
  ...
}

The correct import statement should be

import io.github.cawfree.quiet.RNQuietPackage;
rahul404 commented 4 years ago

Hi, Any update on this?

cawfree commented 4 years ago

Hi @rahul404, apologies for not getting back to you sooner, I'm currently having some trouble receiving updates on issues.

I'm not too sure I understand your question, would you mind documenting the incorrect behaviour, and what kind of errors you're seeing?

In the documentation, it states that we have to specify a dependency on org.quietmodem.Quiet.RNQuietPackage in gradle because this is where the transceiver code lives from the quiet android project.

What version of React Native are you using? (Because automatic linking introduced at 0.60.0 should take care of all of this for us!)

Can you run the example/ app?

gmverdon commented 4 years ago

I am also experiencing this problem.

skullsick commented 4 years ago

I have the same problem. it works in the example app but after installing everything on a fresh react-native app the error appears.

react-native: 0.62.2

iOS is working fine but I get the error

PackageList.java:17: error: cannot find symbol import org.quietmodem.Quiet.RNQuietPackage; ^ symbol: class RNQuietPackage location: package org.quietmodem.Quiet

any suggestions?

cawfree commented 4 years ago

Hi everyone, sorry for the delay in getting back to you.

The project structure has changed and now cloning org.quietmodem. Quiet does not place the android library in a nested quiet/ folder. Just to check, has anybody tried the following in their android/settings.gradle:

include ':quiet'
- project(':quiet').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-quiet/android/org.quietmodem.Quiet/quiet')
+ project(':quiet').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-quiet/android/org.quietmodem.Quiet')
skullsick commented 4 years ago

yes, I tried this already and got another error:

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':app:mergeDebugAssets'.

    Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. Could not resolve project :quiet. Required by: project :app > project :react-native-quiet Unable to find a matching configuration of project :quiet:

    • None of the consumable configurations have attributes.
cawfree commented 4 years ago

@skullsick Sounds like it can’t find the project still. Can I check a couple of things:

skullsick commented 4 years ago

settings.gradle:

rootProject.name = 'XXXX'

include ':react-native-quiet' project(':react-native-quiet').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-quiet/android') include ':quiet' project(':quiet').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-quiet/android/org.quietmodem.Quiet')

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app'

Screenshot 2020-06-14 at 10 08 51 pm

REACT NATIVE INFORMATION System: OS: macOS 10.15.5 CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz Memory: 226.73 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 13.12.0 - /usr/local/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.14.5 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: API Levels: 23, 28 Build Tools: 28.0.3, 29.0.2, 29.0.3 System Images: android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.0 AI-193.6911.18.40.6514223 Xcode: 11.5/11E608c - /usr/bin/xcodebuild Languages: Java: 1.8.0_242 - /usr/bin/javac Python: 2.7.16 - /usr/local/bin/python npmPackages: @react-native-community/cli: ^4.9.0 => 4.9.0 react: ^16.13.1 => 16.13.1 react-native: 0.62.2 => 0.62.2

cawfree commented 4 years ago

@skullsick Thanks a lot for that. It looks okay to me, though am I right assuming the library has been manually linked even though you're running 0.62.X?

cawfree commented 4 years ago

@skullsick I've managed to replicate your issue. :) Halfway there!

skullsick commented 4 years ago

@cawfree yes I linked the lib manually but the same result with autolinking.

cawfree commented 4 years ago

Wow, okay!

So, you'll never guess what.

Basically, because Quiet Android hasn't been published to the Maven Repostory and we have to manually cache it to RNQuiet's directory inside node_modules, it looks like the React Native CLI is tripping up when it tries to find the root project location because there are multiple projects to choose from.

The downloaded asset is called org.quietmodem.Quiet, which takes alphabetical priority over src, which is the location of the actual native module.

If I renamed org.quietmodem.Quiet to Z, the dependency works as expected.

I'll come up with a slightly nicer approach to this problem and I'll be able to publish an update tomorrow evening.

Sorry for the delay in getting back to you all so long on this issue.

cawfree commented 4 years ago

This issue has now been fixed in 0.1.0. You can find the migration instructions here.

Thanks to everyone for their patience on this issue.

skullsick commented 4 years ago

thanks. everything works also with auto-linking. thank you

cawfree commented 4 years ago

@skullsick Thanks for letting me know!