You need to sign in to do that
Don't have an account?
Brian Kessler
Why is Cordova failing when I try to get started with Hybrid Development?
Hi!
I'm currently trying to work my way through the Trailhead "Get Started with Hybrid Development", but am having problems when I attempt to "forcedroid create".
When it gets to "Installing "cordova-plugin-whitelist" for android" it fails with:
This error is not imediately fatal, but after a time I see:
Whereas, this last bit is fatal.
FWIW,
OS: Windows XP SP3
Java: 1.8.0_121
Node: 5.12.0
Npm: 4.2.0
Cordovoa: 6.5.0
ANDROID_HOME: C:\devtools\Android\sdk
ANDROID_SDK_HOME: C:\devtools\Android\sdk
JAVA_HOME: C:\devtools\Java\jdk1.8.0_121
JDK_HOME: %JAVA_HOME%
JRE_HOME: %JAVA_HOME%\jre
CLASSPATH: .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
User PATH: %JAVA_HOME%\bin;C:\Documents and Settings\Brian Kessler\Application Data\npm
System PATH: C:\Documents and Settings\All Users\Application Data\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Pinnacle\Shared Files\InstantCDDVD\;C:\WINXPSP3\system32\WindowsPowerShell\v1.0;C:\Program Files\Skype\Phone\;C:\Program Files\Kensington\TrackballWorks;C:\devtools\Git\cmd;C:\devtools\Git\GitExtensions\;C:\devtools\nodejs\;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools
Any ideas what is wrong or how to fix this?
I'm currently trying to work my way through the Trailhead "Get Started with Hybrid Development", but am having problems when I attempt to "forcedroid create".
When it gets to "Installing "cordova-plugin-whitelist" for android" it fails with:
Failed to install 'cordova-plugin-whitelist':TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.join (path.js:466:7) at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\lib\check_reqs.js:177:42 at _fulfilled (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:834:54) at self.promiseDispatch.done (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:863:30) at Promise.promise.promiseDispatch (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:796:13) at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:857:14 at runSingle (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:137:13) at flush (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:125:13) at _combinedTickCallback (internal/process/next_tick.js:67:7) Failed to restore plugin "cordova-plugin-whitelist" from config.xml. You might need to try adding it again. Error: TypeError: Path must be a string. Received undefined
This error is not imediately fatal, but after a time I see:
Installing "cordova-plugin-whitelist" for android Failed to install 'cordova-plugin-whitelist':TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.join (path.js:466:7) at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\lib\check_reqs.js:177:42 at _fulfilled (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:834:54) at self.promiseDispatch.done (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:863:30) at Promise.promise.promiseDispatch (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:796:13) at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:857:14 at runSingle (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:137:13) at flush (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:125:13) at _combinedTickCallback (internal/process/next_tick.js:67:7) Failed to install 'com.salesforce':TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.join (path.js:466:7) at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\lib\check_reqs.js:177:42 at _fulfilled (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:834:54) at self.promiseDispatch.done (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:863:30) at Promise.promise.promiseDispatch (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:796:13) at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:857:14 at runSingle (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:137:13) at flush (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:125:13) at _combinedTickCallback (internal/process/next_tick.js:67:7) D:\tutorials\AndroidStudioProjects forcedroid create failed Command failed: cordova plugin add https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#v5.0.0 --force Error: Path must be a string. Received undefined
Whereas, this last bit is fatal.
FWIW,
OS: Windows XP SP3
Java: 1.8.0_121
Node: 5.12.0
Npm: 4.2.0
Cordovoa: 6.5.0
ANDROID_HOME: C:\devtools\Android\sdk
ANDROID_SDK_HOME: C:\devtools\Android\sdk
JAVA_HOME: C:\devtools\Java\jdk1.8.0_121
JDK_HOME: %JAVA_HOME%
JRE_HOME: %JAVA_HOME%\jre
CLASSPATH: .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
User PATH: %JAVA_HOME%\bin;C:\Documents and Settings\Brian Kessler\Application Data\npm
System PATH: C:\Documents and Settings\All Users\Application Data\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Pinnacle\Shared Files\InstantCDDVD\;C:\WINXPSP3\system32\WindowsPowerShell\v1.0;C:\Program Files\Skype\Phone\;C:\Program Files\Kensington\TrackballWorks;C:\devtools\Git\cmd;C:\devtools\Git\GitExtensions\;C:\devtools\nodejs\;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools
Any ideas what is wrong or how to fix this?
1. Use Android Studio 2.2.3 (NOT anything newer! And don't allow it to update!)
1. Do not install Android Studio to the default directory or use any other path which contains whitespace.
(Gradle has problems with the whitespace.)
2. Use NOX instead of an Android Studio provided emulator.
(Android's emulators are incompatible with an AMD chipset.)
https://www.bignox.com/
https://www.bignox.com/blog/how-to-connect-android-studio-with-nox-app-player-for-android-development-and-debug/
3. Replace Android SDK Platform Tools with Platform Tools version 16.
(Newer versions of Platform Tools are incompatible with Windows XP.)
http://androidtoolsofflinedownload.blogspot.hu/p/download-android-build.html
4. Copy hprof-conv.exe from recent version of Platform Tools into sdk\platform-tools directory.
(Platform Tools v 16.0 does not include this, but it is needed by Android Studio.)
5. Check if sdk\tools\templates exists.
If not, you need to manually download the SDK from Android and copy the templates into your sdk\tools directory.
6. Use Windows Command instead of Git Bash.
(Forcedroid or Cordova seems incompatible with Git Bash).
7. Put the TrailHybridApps directory on the root
(Gradle has problems with long directory/file paths.)
8. Remove restrictionType attributes from the app_restrictions.xml
(This attributes is not recognized, perhaps as a result of one of the changes above; this causes a fatal error.)
9. Use JDK 1.8 instead of Android's included JRE.
(Gradle has problems with the Android's JRE.)
File > Project Structure > [Platform Settings] > SDKs
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
10. Add the following to the beginning of firstapp\platforms\android\build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
//YOUR DEPEDENCIES
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
11. Allow Android Studio to upgrade Gradle plugin
All Answers
I tried renaming the folder, but it was more trouble than it's worth... Easier to just move the folder. Hope this helps someone else...
Thanks for your response, but I'm a little unclear about your recommendation.
As I have XP, Windows stores its profile data in:
C:\Documents and Settings\Brian Kessler
However, "My Documents" redirects to:
D:\Brian Stuff
Neither of these are relevant to my SDK which is stored in:
C:\devtools\Android\sdk
I'm executing forcedroid create from within git bash, having first navigated to
/d/tutorials/AndroidStudioProjects
So far as I know -- please correct me if I'm wrong -- there is no possiblity to execute the forcedroid node package from within Android Studio.
As far as the Android Studio is concerned, there is an error displaying (in a project which has little to do with this -- I just created a project so I could navigate to the Tools menu), but it is completely different:
Error: CreateProcess error=193, %1 is not a valid Win32 application
... So, I think I may be having different headaches...
Nested under "Gradle 'SFDC_Trailhead' project refresh failed, there is:
Error: CreateProcess error=193, %1 is not a valid Win32 application
1. Use Windows Command instead of Git Bash.
(Forcedroid or Cordova seems incompatible with Git Bash).
And many others:
2. Do not install Android Studio to the default directory or use any other path which contains whitespace.
(Gradle has problems with the whitespace.)
3. Use JDK 1.8 instead of Android's included JRE.
(Gradle has problems with the Android's JRE.)
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
4. Put the TrailHybridApps directory on the root
(Gradle has problems with long directory/file paths.)
5. Use NOX instead of an Android Studio provided emulator.
(Android's emulators are incompatible with an AMD chipset.)
https://www.bignox.com/
https://www.bignox.com/blog/how-to-connect-android-studio-with-nox-app-player-for-android-development-and-debug/
6. Replace Android SDK Platform Tools with Platform Tools version 16.
(Newer versions of Platform Tools are incompatible with Windows XP.)
http://androidtoolsofflinedownload.blogspot.hu/p/download-android-build.html
7. Copy hprof-conv.exe from recent version of Platform Tools into sdk\platform-tools directory.
(Platform Tools v 16.0 does not include this, but it is needed by Android Studio.)
8. Remove restrictionType attributes from the app_restrictions.xml
(This attributes is not recognized, perhaps as a result of one of the changes above; this causes a fatal error.)
Near enough 24 hours later...
... Hope this helps someone else!!!
Here is a sreenshot showing the result of forcedroid create:
I'm using windows 7 .
It seems that the most recent SDK installed by Android no longer includes the template files.
You need to manually download the SDK from Android and copy the templates into your sdk\tools directory.
That said,
Since I started seeing that problem, even with this fix, I haven't gotten the project to actually work... so you may need a specific version of the templates or there may be other requirements I haven't figured out yet.
This is really what I did and it works.
the /sdk/tools/ folder should really contains the template folder to avoid the error.
Best Regards.
I'm still struggling with it.
Going to see if I can get and reinstall an older version of Android Studio as the current one (after a very recent upgrade) won't let me select the JDK anymore.
1. Use Android Studio 2.2.3 (NOT anything newer! And don't allow it to update!)
1. Do not install Android Studio to the default directory or use any other path which contains whitespace.
(Gradle has problems with the whitespace.)
2. Use NOX instead of an Android Studio provided emulator.
(Android's emulators are incompatible with an AMD chipset.)
https://www.bignox.com/
https://www.bignox.com/blog/how-to-connect-android-studio-with-nox-app-player-for-android-development-and-debug/
3. Replace Android SDK Platform Tools with Platform Tools version 16.
(Newer versions of Platform Tools are incompatible with Windows XP.)
http://androidtoolsofflinedownload.blogspot.hu/p/download-android-build.html
4. Copy hprof-conv.exe from recent version of Platform Tools into sdk\platform-tools directory.
(Platform Tools v 16.0 does not include this, but it is needed by Android Studio.)
5. Check if sdk\tools\templates exists.
If not, you need to manually download the SDK from Android and copy the templates into your sdk\tools directory.
6. Use Windows Command instead of Git Bash.
(Forcedroid or Cordova seems incompatible with Git Bash).
7. Put the TrailHybridApps directory on the root
(Gradle has problems with long directory/file paths.)
8. Remove restrictionType attributes from the app_restrictions.xml
(This attributes is not recognized, perhaps as a result of one of the changes above; this causes a fatal error.)
9. Use JDK 1.8 instead of Android's included JRE.
(Gradle has problems with the Android's JRE.)
File > Project Structure > [Platform Settings] > SDKs
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
10. Add the following to the beginning of firstapp\platforms\android\build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
//YOUR DEPEDENCIES
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
11. Allow Android Studio to upgrade Gradle plugin
- Downgraded Cordova (see the "Set Up Your Hybrid Development Environment (https://trailhead.salesforce.com/projects/mobilesdk_setup_dev_tools/steps/mobilesdk_setup_hybrid)" trailhead)
(this got me farther but gave me a new error message about ANDROID_HOME not being set. So, I...
- Set ANDROID_HOME to C:\Users\Natalya\AppData\Local\Android\sdk (*Note: you'll want to change this to point to your local install)
And, FINALLY, I was able to create the app.
P.S. although I initially fiddled around with adding the template folder, this ended up not helping so I restored the original folder settings back.
This is the error I get. I've set the ANDROID_HOME. Help!!!!!
set ANDROID_HOME=C:\ installation location \android\sdk
https://stackoverflow.com/questions/26356359/error-android-home-is-not-set-and-android-command-not-in-your-path-you-must
As far as I know, you are correct that you can not run it from Studio, Granny Mod Menu but I was having the same problem when I ran forcedroid create. If you open SDK Manager from Studio, do you see any errors?
Can we share this script with dynamic hosted wbeiste? I want to try it for my mini militia mod apk (https://apkbeer.com/tivimate-premium-apk/) blog.