Closed DIGITALSQUAD closed 3 years ago
Sorry, adding the line below solved the issue
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
@DIGITALSQUAD I have the same issue but after all this implementation I still get the same error. its first time when I open an android app as I've worked only on ios. Can you please correct me if I am wrong?
MainApplication.java
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new BackgroundGeolocationPackage()
);
}
};
build.gradle
dependencies {
implementation project(':@mauron85_react-native-background-geolocation')
}
settings.gradle
rootProject.name = 'MyProject'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':@mauron85_react-native-background-geolocation-common'
project(':@mauron85_react-native-background-geolocation-common').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/common')
include ':@mauron85_react-native-background-geolocation'
project(':@mauron85_react-native-background-geolocation').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/lib')
include ':app'
Your Environment
Context
I've upgraded react-native from 0.59.8 to 0.63.3 and react-native-background-geolocation from 0.5.3 to 0.6.3. After that successfully works on iOS but fail to build on Android.
I've read issue #394 and modified settings.gradle and build.gradle and MainApplication.java as manual installation.
android/settings/gradle
andrid/app/buid.gradle
MainApplication.java
Expected Behavior
Success to build app.
Actual Behavior
Fail to build app
Possible Fix
Steps to Reproduce
Context
Debug logs