Android PlugIn Setup: groovy.lang.MissingMethodException: No signature of method: org.gradle.initialization.DefaultProjectDescriptor.allprojects() is applicable for ...
Aleks99999 opened this issue · 27 comments
Your Environment
- Plugin version: 4.14.5
- Platform: Android
- OS version: -
- Device manufacturer / model: Xiaomi 13 Pro
- React Native version (
react-native -v
): is not installed yet ('react-ntive -v' doesn't return anything - Plugin config
Expected Behavior
Project synced with updated grandle files (main and app) and ready to integrate for DEBUG version.
Actual Behavior
I'ld like to start working with Android plug-in but after executing all steps from README.md (installing with npm) sync with grandle files fails.
Steps to Reproduce
- npm install react-native-background-geolocation --save
- Android Auto-linking Setup
- npm install react-native-background-geolocation --save
- npm install react-native-background-fetch@^4.2.1
- edit android/build.gradle
- edit app/build.gradle
Context
Install Android PlugIn
Debug logs
groovy.lang.MissingMethodException: No signature of method: org.gradle.initialization.DefaultProjectDescriptor.allprojects() is applicable for argument types: (build_1ofqqn3zh7euwbgl9abwap9os$_run_closure1) values: [build_1ofqqn3zh7euwbgl9abwap9os$_run_closure1@59c019a7]
Post your android/build.gradle
Why are you posting this issue at the background-fetch repo and not background-geolocation?
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
minSdkVersion = 19 // Required minimum
targetSdkVersion = 33 // Or higher.
compileSdkVersion = 33 // Or higher.
appCompatVersion = "1.4.2" // Or higher. Required for new AndroidX compatibility.
googlePlayServicesLocationVersion = "21.0.1" // Or higher.
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.15'
}
}
allprojects {
repositories {
google()
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
// Required for react-native-background-fetch
maven { url("${project(':react-native-background-fetch').projectDir}/libs") }
}
}
/**
* Project-wide configuration properties
*/
ext
{
compileSdkVersion = 33
targetSdkVersion = 33
buildToolsVersion = "26.0.2"
supportLibVersion = "26.1.0"
googlePlayServicesVersion = "11.8.0"
}
Post your android/build.gradle
Why are you posting this issue at the background-fetch repo and not background-geolocation?
By mistake, haven't noticed. Sorry.
I suggest you open your /Android folder with Android Studio and look for warnings.
I opened Android folder in Android Studio and found only warning concerning newer version:
A newer version of com.google.gms:google-services than 4.3.15 is available: 4.4.0. (Problems tab)
A screenshot will help?
Why do you have this orphaned ext
block at the end of your build.gradle
?
/**
* Project-wide configuration properties
*/
ext
{
compileSdkVersion = 33
targetSdkVersion = 33
buildToolsVersion = "26.0.2"
supportLibVersion = "26.1.0"
googlePlayServicesVersion = "11.8.0"
}
I'm not good enough in making grandle configurations. I left it there by mistake. But even if i remove this block the error persists.
post your android/app/build.gradle
.
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: "com.facebook.react"
// background-geolocation
Project background_geolocation = project(':react-native-background-geolocation')
apply from: "${background_geolocation.projectDir}/app.gradle"
android {
compileSdkVersion rootProject.compileSdkVersion
//compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "ru.good4.project1"
minSdkVersion 21
targetSdkVersion rootProject.targetSdkVersion
//targetSdkVersion 33
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
minifyEnabled false
debuggable true
}
}
// This is important, it will run lint checks but won't abort build
lintOptions {
abortOnError false
}
flavorDimensions 'default'
productFlavors {
flavorUfin {
dimension = 'default'
applicationId = 'ru.good4.project1'
}
flavorAnyGPS {
dimension = 'default'
applicationId = 'ru.anygps.web'
}
}
sourceSets {
flavorAnyGPS {
res {
srcDirs 'src/flavorAnyGPS/res', 'src/flavorAnyGPS/res/'
}
manifest {
srcFile 'app/src/flavorAnyGPS/AndroidManifest.xml'
}
}
flavorAnyGPSDebug {
res {
srcDirs 'src/flavorAnyGPS/res', 'src/flavorAnyGPS/res/'
}
}
}
}
repositories {
mavenCentral()
maven { url 'http://JRAF.org/static/maven/2' }
maven { url 'https://maven.fabric.io/public' }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
// react-native-background-fetch
url("${project(':react-native-background-fetch').projectDir}/libs")
}
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.code.gson:gson:2.8.6'
implementation files('libs/simple-xml-2.7.jar')
implementation 'com.makeramen:roundedimageview:1.5.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.jakewharton:butterknife:7.0.1'
implementation 'com.google.android.gms:play-services-auth:20.7.0'
annotationProcessor 'com.jakewharton:butterknife:7.0.1'
implementation 'androidx.core:core:1.0.0'
//# Google Actions, Base Client Library
implementation 'com.google.android.gms:play-services-base:18.2.0'
implementation 'com.google.android.gms:play-services-tflite-java:16.1.0'
//# Google Cloud Messaging
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
//# Google Location, Activity Recognition, and Places
implementation 'com.google.android.gms:play-services-location:17.1.0'
//# Google Maps
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'org.jetbrains:annotations-java5:15.0'
// AppMetrica SDK.
implementation 'com.yandex.android:mobmetricalib:5.3.0'
// Optionally. Play Install Referrer library.
implementation 'com.android.installreferrer:installreferrer:1.0'
implementation 'androidx.core:core:1.0.0'
implementation 'com.yandex.android:mobmetricapushlib:1.4.1'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:23.0.0'
implementation 'com.google.firebase:firebase-auth:17.0.0'
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:29.1.0')
// Add the dependency for the Firebase SDK for Google Analytics
// When using the BoM, don't specify versions in Firebase dependencies
implementation 'com.google.firebase:firebase-analytics'
// Use this dependency to bundle the model with your app
implementation 'com.google.mlkit:barcode-scanning:17.1.0'
implementation 'com.google.android.gms:play-services-code-scanner:16.0.0-beta3'
def work_version = "2.8.1"
// (Java only)
implementation "androidx.work:work-runtime:$work_version"
// Kotlin + coroutines
implementation "androidx.work:work-runtime-ktx:$work_version"
// optional - RxJava2 support
implementation "androidx.work:work-rxjava2:$work_version"
// optional - GCMNetworkManager support
implementation "androidx.work:work-gcm:$work_version"
// optional - Test helpers
androidTestImplementation "androidx.work:work-testing:$work_version"
// optional - Multiprocess support
implementation "androidx.work:work-multiprocess:$work_version"
implementation "androidx.startup:startup-runtime:1.1.1"
implementation "androidx.concurrent:concurrent-futures:1.1.0"
compile "com.android.support:appcompat-v7:$rootProject.supportLibVersion"
compile(project(':react-native-device-info'))
}
configurations {
cleanedAnnotations
compile.exclude group: 'org.jetbrains' , module:'annotations'
}
Why do you have this block in android/app/build.gradle
??
repositories {
mavenCentral()
maven { url 'http://JRAF.org/static/maven/2' }
maven { url 'https://maven.fabric.io/public' }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
// react-native-background-fetch
url("${project(':react-native-background-fetch').projectDir}/libs")
}
}
I suggest you generate yourself a fresh new HelloWorld project and learn to setup and use the plugin in isolation.
You're pasting random stuff into your gradle files and corrupting your own project.
Only needed dependancies, nothing random.
For new project it hardly will be a problem, I need to integrate Plug In in existing project.
I can rollback all actions to the working state and retry the setup if you think that it helps.
Only needed dependancies, nothing random.
These don't belong in android/app/build.gradle
. They are the sort of thing that goes into the root android/build.gradle
.
I've pointed out two glaring mistakes. Who knows what other mistakes lurk in your files. Your problem is related to mistakes in your own project.
What I do periodically when upgrading react-native is generate a fresh new app and migrate my source and dependencies into the new project, using react-native-rename
to rename my project accordingly.
Ok, thank you. Will try both ways tomorrow and return.
//Sure I would not try to integrate the plug-in into broken project.
Hello,
Updated JVM, nodejs, nvm, started Demo app (without console)..
Refactored my grandle files.
Went through Capacitor BackGround Geolocation Setup (including @transistorsoft/capacitor-background-fetch) .
Stucked on:
Project with path ':transistorsoft-capacitor-background-fetch' could not be found in root project 'MobileAppAndroid2'.
Read FAQ, checked Setup process. But fail to understand why sync project with grandle returns:
Project with path ':transistorsoft-capacitor-background-geolocation' could not be found in root project '
in this block:
allprojects {
repositories {
google()
mavenCentral()
//mavenLocal()
// capacitor-background-geolocation
HERE>>> maven { url("${project(':transistorsoft-capacitor-background-geolocation').projectDir}/libs") }
maven { url 'https://developer.huawei.com/repo/' }
// capacitor-background-fetch
maven { url("${project(':transistorsoft-capacitor-background-fetch').projectDir}/libs") }
}
}
I have no idea.
Create a simple HelloWorld to practice setting up / using the plug-in.
Hello World, Android! Absolutely empty simple activity app.. All setup process according with the provided manual for react-native--background-geolocation and react-native-background-fetch results in the same error:
Project with path ':react-native-background-geolocation' could not be found in root project 'My Application'
for this line:
maven { url("${project(':react-native-background-geolocation').projectDir}/libs") }
Please give an idea how to locate in correctly
Publish your simple HelloWorld to a public github repo and post the url here.
Please kindly have a look:
https://github.com/Aleks99999/My-App
That looks nothing at all like a React Native app. That is a pure native Android app.
Let me know when you have a react native app for me to look at. This is a react-native plugin meant for React Native apps.
Ok, thank you for help.
I need to integrate TransistorsSoft to my Android (Native) and later to IOS app.
Can you please suggest should I convert my native app to React Nativa app or start to work with Capacitor?
/I'm not yet enough qulified in Transistorsoft products./
I do not support pure native implementations.
I support only cross platform frameworks:
- React Native
- Capacitor
- Flutter
- Cordova.
I do not provide application development support. I cannot help you to "convert" apps.
Ok, thank you