Apache cordova issue in Netbeans 7.4 - java

I just downloaded Netbeans 7.4 and I am trying to explore Apache Cordova.
When I try to create a new project, I get always BUILD FAILED problem.
Here is the log
ant -f /Users/jason/NetBeansProjects/HTML5Application/nbproject "-Dupdate.task.jar=/Applications/NetBeans/NetBeans 7.4.app/Contents/Resources/NetBeans/webcommon/ant/extra/org-netbeans-modules-cordova-projectupdate.jar" "-Dios.provisioning.profile=/Users/jason/Library/MobileDevice/Provisioning Profiles/6B14AF63-D435-47F0-AF54-F24E2066EEBA.mobileprovision" -Dandroid.project.activity=HTML5Application "-Dios.certificate.name=iPhone Developer" -Denv.DISPLAY=:0.0 -Dsite.root=www_nb_temp "-Dcordova.version=3.1.0-0.2.0
"upgrade-to-cordova-project
check-cordova-project:
check-cordova-version:
upgrade-to-cordova-project:
cordova -d create . com.coolappz.HTML5Application HTML5Application
Error: Path already exists and is not empty: /Users/jason/NetBeansProjects/HTML5ApplicationCreating a new cordova project with name "HTML5Application" and id "com.coolappz.HTML5Application" at location "/Users/jason/NetBeansProjects/HTML5Application"
at CLI.create (/usr/local/lib/node_modules/cordova/src/create.js:63:25)
at new CLI (/usr/local/lib/node_modules/cordova/src/cli.js:105:30)
at Object.<anonymous> (/usr/local/lib/node_modules/cordova/bin/cordova:41:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
/Users/jason/NetBeansProjects/HTML5Application/nbproject/build.xml:78: exec returned: 1
BUILD FAILED (total time: 1 second)
I have already node.js installed (version v0.10.20) and Apache Cordova (3.1.0-0.2.0)
What is the solution? It is a bug ?

Actually I got the problem is not a Netbeans bug, it is an Apache Cordova bug at the version 3.1.0-0.2.0 (Latest until now).
The solution is to downgrade from the version 3.1.0-0.2.0 to 3.1.0-0.1.0 and everything will work fine:
sudo npm uninstall -g cordova
sudo npm install -g cordova#3.1.0-0.1.0
Thank you #Geertjan & #Cocorico for your help

Maybe try to name your app to see what appens :
cordova -d create "HTML5Application" com.coolappz.HTML5Application HTML5Application
Also, check all environment variables (ant,java,...) even if it seems to be good :
java --version
...
Try to change the folder name and app name and come back here to tell what happened.

Related

CERTIFICATE_VERIFY_FAILED when trying to build java-cef

I'm trying to build java-cef on ubuntu following instructions from https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding.
At cmake step
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
i get
-- Downloading clang-format from Google Storage...
Failed to fetch file gs://chromium-clang-format/942fc8b1789144b8071d3fc03ff0fcbe1cf81ac8 for tools/buildtools/linux64/clang-format. [Err: /home/x/Desktop/jcef/src/tools/buildtools/external_bin/gsutil/gsutil_4.15/gsutil/third_party/boto/boto/pyami/config.py:71: UserWarning: Unable to load AWS_CREDENTIAL_FILE ()
warnings.warn('Unable to load AWS_CREDENTIAL_FILE (%s)' % full_path)
Failure: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727).
]
Terminal indicates that I'm using Python 2.7.15+.
How can i make it work? Many thanks.
In the folder where it has created the build jcef/src/tools/buildtools/download_from_google_storage.py change the version parameter of gsutil to a recent version, like 4.39. If you don't find specified file use a tool like find.

The module to run \"java\" is not found among the available application modules

When trying to PUT a Java application onto NGINX Unit it throws an error:
root#localhost:~# curl -X PUT -d#start.json '127.0.0.1:8443/config/'
{
"error": "Invalid configuration.",
"detail": "The module to run \"java\" is not found among the available application modules."
}
Using unit version 1.8.0
What could be missing here?
Apparently, the JSC module must be installed separately:
# apt update
# apt install unit
# apt install unit-dev unit-go1.9 unit-go1.10 unit-jsc8 unit-jsc10 unit-php \
unit-perl unit-python2.7 unit-python3.6 unit-ruby
After the installation, Java apps would be able to deploy.

Command failed: gradlew.bat installDebug

While developing an app I came into following error. I tried downgrading the java version from 11 to 8, but that wasn't helpful.
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
* 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
BUILD FAILED in 15s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnAllDevices (C:\Users\samie\Documents\React Native\auth\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (C:\Users\samie\Documents\React Native\auth\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (C:\Users\samie\Documents\React Native\auth\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
How I solved this problem:
First, make sure that I have %java_home% variable set and also %path% has the java sdk included.
How to setup Java environment variables
Second, Go to your android folder and run this command:
C:\Projects\myproject\android>gradlew.bat app:installDebug.
Unzipping
C:\Users\codeb.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv\gradle-4.10.2-all.zip
to
C:\Users\codeb.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv
Exception in thread "main" java.util.zip.ZipException: error in
opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:225)
at java.util.zip.ZipFile.(ZipFile.java:155)
at java.util.zip.ZipFile.(ZipFile.java:169)
at org.gradle.wrapper.Install.unzip(Install.java:215)
at org.gradle.wrapper.Install.access$600(Install.java:27)
at org.gradle.wrapper.Install$1.call(Install.java:75)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
As you can see that my gradle download is corrupt. All you have to do is delete this folder and rerun the command.
C:\Projects\myproject\android>gradlew.bat app:installDebug
Downloading
https://services.gradle.org/distributions/gradle-4.10.2-all.zip
...............................................................................................................
Unzipping
C:\Users\codeb.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv\gradle-4.10.2-all.zip
to
C:\Users\codeb.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv
Welcome to Gradle 4.10.2!
Here are the highlights of this release:
- Incremental Java compilation by default
- Periodic Gradle caches cleanup
- Gradle Kotlin DSL 1.0-RC6
- Nested included builds
- SNAPSHOT plugin versions in the plugins {} block
For more details see https://docs.gradle.org/4.10.2/release-notes.html
Now, you can go back to your react native project and run
react-native run-android
info JS server already running. info Building and installing the app
on the device (cd android && gradlew.bat app:installDebug)...
Task :app:installDebug 01:03:18 V/ddms: execute: running am get-config 01:03:18 V/ddms: execute 'am get-config' on 'emulator-5554'
: EOF hit. Read: -1 01:03:18 V/ddms: execute: returning Installing APK
'app-debug.apk' on 'Pixel_2_API_28(AVD) - 9' for app:debug 01:03:18
D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554'
01:03:18 D/Device: Uploading file onto device 'emulator-5554' 01:03:18
D/ddms: Reading file permision of
C:\Projects\xx\android\app\build\outputs\apk\debug\app-debug.apk
as: rwx------ 01:03:18 V/ddms: execute: running pm install -r -t
"/data/local/tmp/app-debug.apk" 01:03:19 V/ddms: execute 'pm install
-r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1 01:03:19 V/ddms: execute: returning 01:03:19 V/ddms: execute:
running rm "/data/local/tmp/app-debug.apk" 01:03:19 V/ddms: execute
'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit.
Read: -1 01:03:19 V/ddms: execute: returning Installed on 1 device.
BUILD SUCCESSFUL in 9s 27 actionable tasks: 1 executed, 26 up-to-date
info Running
C:\Users\codeb\AppData\Local\Android\Sdk/platform-tools/adb -s
emulator-5554 reverse tcp:8081 tcp:8081 info Starting the app on
emulator-5554
(C:\Users\codeb\AppData\Local\Android\Sdk/platform-tools/adb -s
emulator-5554 shell am start -n
com.myproject/com.myproject.MainActivity)... Starting:
Intent { cmp=com.myproject/.MainActivity }
Try running this command inside your project file
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
after that
cd (path to project/android folder) && gradlew clean && cd .. && react-native run-android
always gradlew clean before run react-native-run-android
the above command basically cleans up the gradle and previous builds.
for ENOENT Error
Check if $ yarn start works. The metro bundler wasn't able to run on port 8081 for me and I needed to run $ killall node
EDIT:
Also update the gradle-wrapper.properties
add
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
remove following code from build.gradle:
task wrapper(type: Wrapper) {
gradleVersion = '5.2.1'
distributionUrl = distributionUrl.replace("bin", "all")
}
after that
cd (path to project/android folder) && gradlew clean && cd .. && react-native run-android
always gradlew clean before run react-native-run-android the above command basically cleans up the gradle and previous builds.
You're good to go!
Just run sudo react-native run-android and it will build and install ./gradlew app:installDebug inside android directory for you.
I had this issue too and I was able to fix it by creating a new project in react-native 0.57.3 using the command:
react-native init --version="0.57.3" MyNewApp
You have to update the gradle-wrapper.properties file to use the newest version of gradle:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
And remove this block from build.gradle file:
task wrapper(type: Wrapper) {
gradleVersion = '5.2.1'
distributionUrl = distributionUrl.replace("bin", "all")
}
Then run a gradlew clean on the android folder and everything should work.
I had this issue too and I was able to fix it by run ./gradlew app:installDebug in android folder .
In my case, I uninstalled my java jdk17 and installed java jdk11. It worked for me few seconds ago. Really happy :)))
I had this issue myself, it eventually went away after I uninstalled and re-installed android studio and gradle, but a few other things you could try first
1: Setting GRADLE_USER_HOME in environment variables (if on windows)
2: Downgrade to react-native 0.57.0
3: Make sure you have the correct permissions to run the command and access files
4: Make sure your gradle files are synced correctly, and that location of gradle and the android skd are correct within project structure offline mode
5: Check gradle for updates
(Assuming you are using android studio)
Good luck
The problem is on file:
nameyourapp/android/local.properties
you have to substitute with the correct path: /Users/nameUser/AppData/Local/Android/sdk
I have the same error I just uninstall the JDK old version and install the latest version from https://www.oracle.com/java/technologies/javase-downloads.html and now it's working.
Open your settings.grandler file in the android folder
Change the \ to /
Save the file
Run the command react-native run-android

Building phone gap app for Android failing

When trying to build my phone gap app for android using
sudo phonegap build android
it fails with this error:
:compileDebugJava
/Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:120: error: cannot find symbol
|| Config.isUrlWhiteListed(url)) {
^
symbol: method isUrlWhiteListed(String)
location: class Config
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
FAILED
FAILURE:
Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJava'.
>
Compilation failed; see the compiler error output for details.
* Try:
Run with
--stacktrace option to get the stack trace. Run with
--info or
--debug
option to get more log output.
BUILD FAILED
Total time: 5.607 secs
/Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
I tried setting the java_home to the java alias in lib exec but still nothing. Any ideas on what maybe causing the problem?
It's because your InAppBrowser plugin is out date and probably out of sync with a newer version of the Cordova Android platform than when you first installed the plugin. I was getting the same issue with cordova-android#4.0.0 and 0.5.3 of InAppBrowser.
Fix is to first remove plugin
cordova plugin rm org.apache.cordova.inappbrowser
Then add it again (it should reinstall with the latest version the cordova CLI has in my case it grabbed 0.6). You can check the version in the RELEASENOTES.md in the plugins/org.apache.cordova.inappbrowser/ folder.
cordova plugin add org.apache.cordova.inappbrowser
You will need to remove the android platform and re-add it before building again so it doesn't keep the old version of the plugin.
cordova platform rm android
and
cordova platform add android
Now build again and the error should have gone.
EDIT: I just noticed at the top of your question you are using phonegap. Since you tagged with cordova (and thats what I use) I answered with cordova commands, but I'm guessing almost the same process applies with Phonegap.
Same problem with cordova-android#4.0.0
Thank's JDawgg your solution's better than mine, but if someone still have the bug you can use cordova-android#3.6.4 like this :
cordova platform remove android
then
cordova platform add android#3.6.4
you must have android 4.2.2 sdk installed
Finally
sudo phonegap build android
In case someone is using Meteor and came across the same problem, martijnwalraven suggests removing the older version of cordova-plugin-inappbrowser and add the most recent one:
$ meteor remove cordova:cordova-plugin-inappbrowser
$ meteor add cordova:cordova-plugin-inappbrowser#1.0.1
This did the trick for me!

Can't build cordova projects

I have a problem with setting up the work environment for Cordova on Windows 7 for Android. I use NetBeans 8 and followed this guide: Link Here
New project -> Cordova -> Hello World Template.
Whenever I try to build a Cordova project (in NetBeans) I get this message:
BUILD FAILED
C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml:90: Cannot find C:\Users\Administrator\SkyDrive\Skolegang\Dataingeniør\Android\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml imported from C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml
Total time: 0 seconds
C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\cordova\node_modules\q\q.js:126
throw e;
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\cordova\run.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
Command finished with error code 8: C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\cordova\run.bat --emulator
C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\nbproject\build.xml:272: exec returned: 1
BUILD FAILED (total time: 47 seconds)
I have googled it for hours but can't seem to find a solution. Some people get some of the same errors(not exact, but similar), but the solutions did not work for me. One issue was regarding Java 8 and ant versions beneath 1.9.0 (I use Node 0.10.26, java 1.7.0_25, cordova 3.5.0-0.2.4 and ant 1.9.4). I also tried to create a new project with the console (CMD), but it gives the exact same error when I build. It's no problem to create the project, nor adding Android as a platform, the problem is building the project. I think the environment variables are set correctly since the java, node, ant and cordova commands work fine in cmd/powershell, and the check_reqs.bat said that the environment was fine.
It's this line that creates the error: <import file="${sdk.dir}/tools/ant/build.xml" />. This is the rest of the message: Cannot find C:\Users\Administrator\SkyDrive\Skolegang\Dataingeniør\Android\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml imported from C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml.
Here is the error I get in the command window (not using NetBeans):
PS C:\Users\Administrator\Desktop\test\fakeApp> cordova build android
Running command: C:\Users\Administrator\Desktop\test\fakeApp\platforms\android\cordova\build.bat
Buildfile: C:\Users\Administrator\Desktop\test\fakeApp\platforms\android\build.xml
BUILD FAILED
C:\Users\Administrator\Desktop\test\fakeApp\platforms\android\build.xml:90: Cannot find C:\Users\Administrator\SkyDrive\
Skolegang\Dataingeni├©r\Android\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml imported from C:\Users\Admini
strator\Desktop\test\fakeApp\platforms\android\build.xml
Total time: 0 seconds
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\Users\Administrator\Desktop\test\fakeApp\platforms\androi
d\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: C:\Users\Administrator\Desktop\test\fakeApp\platforms\android\cordova\build.bat: Command failed with exit code 2
at ChildProcess.whenDone (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\s
rc\cordova\superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
I thought maybe it was a path issue since I have a special letter in the path were the NetBeansProjects are stored (and it's pretty long too), but creating a test directory at C:\ and creating the project with the command window gave the same error. I'm new at Cordova so I'm sure there's an easy solution, thanks in advance.
I solved it, though I tried to create a cordova project outside the OneDrive folder I did not think of the SDK path (which also were stored in OneDrive). By moving the SDK files to C: (the path could probably not contain the special letter 'ø') and changing the path of the environment variables (and the SDK path in NetBeans) it now runs perfectly.

Categories

Resources