[SOLVED] Start from scratch get error in run android-device


I want to start from scratch to a new app, run also on android, so simple I made:

meteor create --react prova
cd prova
meteor add-platform android
meteor run android-device

but I get this errors:

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type PluginManagerInternal using SettingsScopeServices.createPluginManager().
> Could not generate a proxy class for class org.gradle.api.internal.plugins.DefaultPluginManager.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

=> Started your app.                          
=> App running at: http://localhost:3000/     
=> Errors executing Cordova commands:         
   While running Cordova app for platform Android with options
   Error: /usr/share/gradle/bin/gradle: Command failed with exit code 1
   at ChildProcess.whenDone (/home/dave/dev/meteor/prova/.meteor/local/cordova-build/node_modules/cordova-common/src/superspawn.js:135:23)
   at ChildProcess.emit (events.js:315:20)
   at maybeClose (internal/child_process.js:1021:16)
   at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
   => awaited here:
   at Function.Promise.await
   at /tools/cordova/project.js:342:7
   => awaited here:
   at Function.Promise.await
   at CordovaProject.runCommands (/tools/cordova/project.js:894:22)
   at /tools/cordova/project.js:340:10
      throw error;
ExitWithCode {
  code: 1,
  stack: 'undefined\n' +
    ' => awaited here:\n' +
    '    at Function.Promise.await (/home/dave/.meteor/packages/static-html/.\n' +
    '    at /tools/cordova/run-targets.js:111:5\n' +
    '    at /home/dave/.meteor/packages/static-html/.\n' +
    ' => awaited here:\n' +
    '    at Function.Promise.await (/home/dave/.meteor/packages/static-html/.\n' +
    '    at /tools/cordova/runner.js:98:17\n' +
    '    at Object.capture (/tools/utils/buildmessage.js:283:5)\n' +
    '    at CordovaRunner.startRunTargets (/tools/cordova/runner.js:97:37)\n' +
    '    at AppRunner._runOnce (/tools/runners/run-app.js:764:21)\n' +
    '    at AppRunner._fiber (/tools/runners/run-app.js:931:28)\n' +
    '    at /tools/runners/run-app.js:401:12'

I have another app and it works good when I run in android device and when I build for android, I can’t understand why other works and this no…

Do you have a mobile-config in your root?

whit or without mobile-config.js the behaviour is the same.
Also “meteor build [path] --server=https://prova[.domain.tld]” command give me the same errors.
I also tried to delete “/.meteor.local” and “/node_modules” directories but not lucky…

After several investigates I found the solution.
I have to put 2 files in path “/prova/.meteor/local/cordova-build/platforms/android/gradle/wrapper”, “gradle-wrapper.jar” and “gradle-wrapper.properties” and one file in “/prova/.meteor/local/cordova-build/platforms/android/gradle/wrapper/gradlew”.
I cant understand the real reason.
Somebody know why ?

I also had a lot of problems when I developed the Push package. Maybe you can find some clues here: https://github.com/activitree/meteor-push/blob/master/README.md#android

Ok, now is all clear.
The problem is gradle installed on pc.
Remove gradle, restart pc (because the daemon keeping live) and all works good now, without put manually the files I have say before, the build process download the necessary and configure it.
So, the rule to run or build android app is: don’t have a Gradle installed !