I'm able to run NativeScript simple example. However, I am getting 'spawn gradle.bat ENOENT' when I'm trying to build a project where multidex is enabled. Here is my build log:
http://pastebin.com/mf6ZHVA0
Thanks,
Hey @Plamen5kov,
Do you know what can cause this?
Hi @ali-hooshmand
spawn gradle.bat ENOENT
What this message means is, cli can't find the platforms/android/gradle.bat file and run it. Make sure the file exists.
Could you provide us with some additional information. As I understand you had a working project and you tried to enable multidex support, so you probably did some changes. It would be helpful, if you could describe the steps you made from the start to finish.
What command did you try to run, and what version of cli are you using. You can check by running tns --version
Also this problem may have something to do with Analytics.
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track exception with message 'spawn gradle.bat ENOENT'.
@ivanbuhov, @rosen-vladimirov
Hi @Plamen5kov,
Thanks for the reply. FIrst, I check platforms/android and as you guessed I don't have the gradle.bat. How can I create this file?
Also, here are the steps I made:
This happened after I added nativescript-plugin-firebase to the project. All I did was:
"tns plugin add nativescript-plugin-firebase"
and then I added "GoogleService-Info.plist" file to platforms/android.
Then I added following lines to platforms/android/build.gradle:
in dependencies, added: "com.google.gms:google-services:3.0.0" and at the end of file "apply plugin: "com.google.gms.google-services""
Finally enabled Multidex by adding "multiDexEnabled true" in app.gradle.
Thanks..
Hi @ali-hooshmand
How can I create this file?
You can create another NativeScript project and copy platforms/android/gradlew.bat to your project.
Then I added following lines to platforms/android/build.gradle
The place where you should add gradle dependencies is in app/App_Resources/Android/app.gradle instead of platforms/android/build.gradle.
and then I added "GoogleService-Info.plist" file to platforms/android.
GoogleService-Info.plist and .plist as an extension is used in iOS projects. The Android equivalent of the .plist is the AndroidManifest.xml.
Finally enabled Multidex by adding "multiDexEnabled true" in app.gradle.
If you want to enable multidex support you can see an example here. You need to do more than enabling it in the gradle configuration. Read more here.
Run this:
tns platform remove android
then:
tns platform add android
Am still having problem with this. I tried all the solutions suggested here, none worked. Any help please?
I got this sorted out. I think it is a permission issue. I moved my project folder to desktop and it worked perfectly well...
Run this:
tns platform remove androidthen:
tns platform add android
this worked for me..
tns install worked for me
For me, I ran into this error when executing "tns update" to upgrade from NativeScript 7 to NativeScript 8. The first step of this process is to "clean old project artifacts", which must wipe out most of platforms/android. However, at the end of the upgrade it never restores these files. I would consider this a bug in the NativeScript upgrade process...
@justintoth - The platforms/* files are all artifacts of building. So the next time you do a tns run android or tns build android it will automatically repopulate the platforms/android folder.
@NathanaelA Unfortunately, that's not what happened when executing tns run android. Instead, it gave the spawn gradle.bat ENOENT error. I had to use the tns platform remove android / tns platform add android trick to get it to generate again.
platforms/ after it upgraded as you said "which must wipe out most of platforms/android" tns run or tns debug still running when you tried to upgrade?Excellent questions...
I guess that explains it! Thanks for the follow-up.
Most helpful comment
Run this:
tns platform remove androidthen:
tns platform add android