I try to create a sample Cordova project in Netbeans after starting an Android emulator.
This is exactly what I am getting when I run the project:
cordova.cmd -d create C:\DOCUME~1\user\LOCALS~1\Temp\/nb_temp_project com.coolappz.Cordova Cordova
Creating a new cordova project with name "Cordova" and id "com.coolappz.Cordova" at location "C:\DOCUME~1\user\LOCALS~1\Temp\nb_temp_project"
Using stock cordova hello-world application.
cordova library for "www" already exists. No need to download. Continuing.
Copying stock Cordova www assets into "C:\DOCUME~1\user\LOCALS~1\Temp\nb_temp_project\www"
Copying 6 files to C:\Documents and Settings\user\My Documents\netbeans7.41projects\Cordova
Deleting directory C:\DOCUME~1\user\LOCALS~1\Temp\nb_temp_project
Deleting directory C:\Documents and Settings\user\My Documents\netbeans7.41projects\Cordova\www
Copying 13 files to C:\Documents and Settings\user\My Documents\netbeans7.41projects\Cordova\www
create-android:
cordova.cmd -d platform add android
cordova library for "android" already exists. No need to download. Continuing.
'C:\Documents' is not recognized as an internal or external command,
Checking if platform "android" passes minimum requirements...
Creating android project...
Running command: cmd args=["/c","C:\\Documents and Settings\\user\\.cordova\\lib\\android\\cordova\\3.4.0\\bin\\create","--cli","C:\\Documents and Settings\\user\\My Documents\\netbeans7.41projects\\Cordova\\platforms\\android","com.coolappz.Cordova","Cordova"]
Command finished with error code 1: cmd /c,C:\Documents and Settings\user\.cordova\lib\android\cordova\3.4.0\bin\create,--cli,C:\Documents and Settings\user\My Documents\netbeans7.41projects\Cordova\platforms\android,com.coolappz.Cordova,Cordova
operable program or batch file.
C:\Documents and Settings\user\My Documents\netbeans7.41projects\Cordova\nbproject\build.xml:145: exec returned: 1
BUILD FAILED (total time: 5 seconds)
First, try to run your project in web browser before you build in Android application. If there is no error or bug, then compile the project to Apk. you have to connect internet while in progress
Related
Hello I am new to Flutter I have setup flutter with android studio 4.2.1, and every thing is fine. When I try to run it; it show me following error
I see too much questions but it is not helpfull for me
flutter doctor run no issue found
Hers is doctor result
Here is my enviroment variable
can any one guide me how can I run the flutter. I am lunching it in a chrome
exception in thread "main" java.util.zip.ZipException: zip END header not found at
java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1567) at
java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1462) at
java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1469) at
java.base/java.util.zip.ZipFile$Source.(ZipFile.java:1274) at
java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1237) at
java.base/java.util.zip.ZipFile$CleanableResource.(ZipFile.java:727)
at
java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:844)
at java.base/java.util.zip.ZipFile.(ZipFile.java:247) at
java.base/java.util.zip.ZipFile.(ZipFile.java:177) at
java.base/java.util.zip.ZipFile.(ZipFile.java:191) at
org.gradle.wrapper.Install.unzip(Install.java:214) at
org.gradle.wrapper.Install.access$600(Install.java:27) at
org.gradle.wrapper.Install$1.call(Install.java:74) at
org.gradle.wrapper.Install$1.call(Install.java:48) at
org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48) at
org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at
org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Exception: Gradle task assembleDebug failed with exit code 1
I recently Solved this problem.
This Problem came from gradle file is corrupted in my system.
I'm using Linux so this steps almost same in windows also. This answer is for any gradle version.
Open File Manager:
enable Show hidden folder from top menu bar.
You may find this location : .gradle>wrapper>dists.
In Linux: Home > .gradle > wrapper > dists.
In Windows: C:>Users>{PC Name}>.gradle>wrapper>dists
Method 1
Go inside gradle-6.5-all > dists > 2oz4ud9k3tuxjg84bbf55q0tn. '2oz4ud9k3tuxjg84bbf55q0tn' may be different in your PC.
Delete all files in that folder and download required file manually: https://downloads.gradle-dn.com/distributions/gradle-6.5-all.zip
after download paste freshly downloaded zip file in that folder.
Run your project flutter run -v
Method 2
Try this if you have fast & stable internet connection.
Delete that gradle-6.5-all folder.
Open project in VS code or Android Studio and open terminal.
Run this command flutter run -v
Method 3
Flutter Doctor will give right result.
Open Android Studio
Create new flutter project
Click on Tools > flutter >Flutter for editing in android studio
and wait, flutter doctor takes time to identify problem.
Use this link for download gradle file.
Replace 6.5 with your gradle version.
https://downloads.gradle-dn.com/distributions/gradle-6.5-all.zip
I hope this answer helpful for you.
Please use the below command
1.Mac User :
rm -rf ~/.gradle
2.Windows User :
remove the .gradle file
.gradle file location -> C:\Users\myUser
I solve this error by updating the gradle plugin/version. I have as part of my configuration:
Windows 10
Android Studio 4.2.1
Java 11: Android Studio 4.2.1 don't have support for JDK 16, so, I installed JDK 11, and configured the AS (how to change the jdk in AS) to use this older JDK
Gradle 7.0.1
By default, when you create a new Flutter project, the IDE created it with basic standard configurations, so you have to change this configs to fit your current config. For that, you need to update the gradle config in the flutter project, as follow:
in android/gradle/build.gradle file: update the gradle plugin to 4.2.0 in the dependencies section, like this:
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
//more dependencies
}
in android/gradle/wrapper/gradle-wrapper.properties file: update the gradle version, in this case I have the 7.0.1, feel free to use another one, like this
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-all.zip
//more attributes
After you change the gradle config, run this commands in your project:
flutter clean : clean the project
flutter pub get : update your dependencies
flutter run : run the project. Now it must work, at least it work for me
I faced the same problem in VSCode when I wanted to run the Flutter app I got that error, so after lots of debugging and research, I found the solution. it's pretty easy, just follow these steps:
In windows 10:
1. Open flutter project in a Text-Editor like VSCode.
2. Open android -> gradle -> wrapper -> gradle-wrapper.properties
3. You will find "gradle-6.7.1.all.zip" inside gradle-wrapper folder
4. Go to this path: C:\Users\your-user
5. Then go to the wrapper->dists and find "gradle-6.7.1.all" folder
5. Delete this folder.
6. Then come to VSCode and open Terminal.
7. Please make sure that you have stable internet connection then type this command in terminal
8. flutter run
I hope this solution can help you!
I solve this error by deleting the .gradle folder.
This location is gradle folder
In Windows: C:> Users> {PC Name}>. Gradle
After deleting this folder, you only need to run the application again in Android Studio. At this point, Android Studio starts downloading the deleted folder automatically.
enter image description here
This error is caused by corrupted gradle files, this is either due to incomplete downloads due to network issues. To solve it easily download the gradle zipped file from https://downloads.gradle-dn.com/distributions/gradle-6.7-all.zip and paste on the .gradle directory as shown below if you are on linux
enter image description here
I try all method but it did not work for me so i decided to location the gradle-wrapper.properties in the andriod folder then i change the distribution gradle link to a more recent gradle link.
Welcome SO.
Java 16/latest version is not fully compatible with the Gradle 6 at this moment. Try to use java 11 or 8, it will resolve your issue.
Installing "cordova-plugin-firebase" for android
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-firebase': Error: Uh oh!
EPERM: operation not permitted, unlink 'F:\ionic\PkjshopMerchant\platforms\android\app\src\main'
at Object.unlinkSync (fs.js:1129:3)
at mayCopyFile (F:\ionic\PkjshopMerchant\platforms\android\cordova\node_modules\fs-extra\lib\copy-sync\copy-sync.js:59:8)
As commented in this link : https://github.com/arnesson/cordova-plugin-firebase/issues/1154
there is a posible solution for it that is not downgrading to cordova#8.0.0
Studying the error message that occurs during the installation of the firebase plugin, we made a debug session and found that things were going wrong while the plugin was trying to copy google-services.json file from the plugin folder to the project folder.
The error message was:
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-firebase-lib': Error: Uh oh!
EPERM: operation not permitted, unlink '[My project folder]\apk\platforms\android\app\src\main'
It's something to the with file write permissions but we couldn't solve this by changing folder permissions and indexing.
From the stack trace, we saw that the copy operation was handled by the mayCopyFile function in the copy-sync.js javascript file that was located in the ..\apk\node_modules\fs-extra\lib\copy-sync folder.
Here's the function body:
function mayCopyFile (srcStat, src, dest, opts) {
if (opts.overwrite) {
fs.unlinkSync(dest)
return copyFile(srcStat, src, dest, opts)
} else if (opts.errorOnExist) {
throw new Error('${dest}' already exists)
}
}
fsunlinkSync and copyFile calls here crashes the installation. We couldn't proceed with the debug further, perhaps it would be better to proceed but we stopped here and found this solution:
Since these lines of code is trying to copy google-services.json file from the
..\apk\plugins\cordova-plugin-firebase\src\android
location to the
..\apk\platforms\android\app\src\main destination,
we decided to do this copy manually.
So here are the steps we followed:
Make sure you have a clean cordova project folder with no firebase plugin.
Have the android platform 9.0.0, if already not:
cordova platform rm android
cordova platform add android#9.0.0
Comment out the lines fsunlinkSync and copyFile in the mayCopyFile function in the ..\apk\node_modules\fs-extra\lib\copy-sync copy-sync.js file.
install firebase plugin:
cordova plugin add cordova-plugin-firebase-lib#3.0.0
(We've always been using this lib. Unfortunately cordova-plugin-firebase gives other build errors)
See that the plugin is installed and the platform is android 9.0.0
cordova plugin ls
cordova platform ls
Copy google-services.json file from
..\apk\plugins\cordova-plugin-firebase\src\android
location to the
..\apk\platforms\android\app\src\main destination,
manually.
Before the cordova build, uncomment the code lines you commented out in the 3rd step, because cordova build is going to copy lots of files from some source location to some destination location that isn't smart to copy manually.
Edit build.gradle file in the apk\platforms\android folder (change the gradle version appropriately):
classpath 'io.fabric.tools:gradle:1.28.0'
cordova build android
cordova run android
This worked. Of course, we added the cordova-device-plugin, edited the config.xml, added google-services.json to the project root folder etc as usual prerequisites, to make the plugin work.
i am trying to build a sample HTML5 Application with Netbeans/Cardova.
Cardova: 3.4.0-0.1.0
Netbeans: 7.4
Reproducing:
Device: Cordova Android Device
Press Build
Window "Create Cordova Resources and rename site root to 'www'?"
Answer With "OK"
Output:
ant -f D:\\phonegap\\CordovaMapsSample\\nbproject -Dandroid.target.device.arg=run -Denv.DISPLAY=:0.0 "-Dupdate.task.jar=C:\\Program Files (x86)\\NetBeans 7.4\\webcommon\\ant\\extra\\org-netbeans-modules-cordova-projectupdate.jar" -Dandroid.sdk.home=D:\\androidsdk -Dandroid.build.target=android-19 -Dstart.file=index.html -Dandroid.project.activity=CordovaMapsSample -Dconfig=android_1 "-Dios.certificate.name=iPhone Developer" -Dsite.root=www_nb_temp "-Dcordova.version=3.4.0-0.1.0
" sim-android
check-android-template:
check-cordova-version:
check-cordova-project:
upgrade-to-cordova-project:
cordova.cmd -d create . com.coolappz.CordovaMapsSample CordovaMapsSample
Path already exists and is not empty: D:\phonegap\CordovaMapsSample
Creating a new cordova project with name "CordovaMapsSample" and id "com.coolappz.CordovaMapsSample" at location "D:\phonegap\CordovaMapsSample"
D:\phonegap\CordovaMapsSample\nbproject\build.xml:78: exec returned: 1
BUILD FAILED (total time: 0 seconds)
That's it :/
Please Help me!
Give it a try with with NetBeans 8.0 RC1, If I remember correctly, there was some change related to project structure in latest Cordova and NetBeans 7.4 might not be working with it.
To download 8.0 RC1, visit this page
I have uninstalled cordova 1.9.0 by doing:
To uninstall:
Remove the PHONEGAPLIB value in Xcode Preferences -> Source Trees
Delete the ~/Documents/PhoneGapLib folder
Delete the ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/PhoneGap folder
Delete the "~/Library/Application Support/Developer/Shared/Xcode/Templates/Project Templates/Application/PhoneGap-based Application.xctemplate" or the "~/Library/Developer/Xcode/Templates/Project\ Templates/Application/PhoneGap-based\ Application.xctemplate" folder
Delete the /Users/Shared/PhoneGap/Frameworks/PhoneGap.framework folder
Delete the ~/Library/Frameworks/PhoneGap.framework symlink
I then followed the upgrade guides:
http://github.com/apache/incubator-cordova ios/blob/master/guides/Cordova%20Plugin%20Upgrade%20Guide.md
and http://docs.phonegap.com/en/2.1.0/guide_upgrading_ios_index.md.html
The project builds with no errors, but when I try to run:
On an iPhone with iOS 5.1.1 I get this error:
ERROR: Start Page at 'www/index.html' was not found.
and on an iPhone with iOS 6.0 I get this error:
Failed to load webpage with error: The requested URL was not found on this server.
Whether I remove the only external link or all javascript sources, whether I manually add the www folder, or anything at all that can be found on the internet, these errors are persistent.
Apparently this problem was first noticed in cordova 1.4 and I followed this solution http://www.tricedesigns.com/2012/02/16/linked-source-files-across-phonegap-projects-on-osx/
The problem was that Xcode could not see the www folder.
I try to run apk file in android, i follow these steps
1. First get the Android SDK and unzip it somewhere on your hard drive
2. Add SDK_ROOT to your system variables pointing to /tools folder under the sdk
3. Run the emulator
4. Copy the apk file to /tools folder
5. Change directory to /tools and run from commandline $adb install your_application.apk 6. Now check applications list in the emulator and you should see the new application installed and ready.
but i get this type of error :
" [2011-01-11 17:02:15 - Logcat]device not found
com.android.ddmlib.AdbCommandRejectedException: device not found
at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:736)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:373)
at com.android.ddmlib.Device.executeShellCommand(Device.java:284)
at com.android.ddmuilib.logcat.LogPanel$3.run(LogPanel.java:527) "
can you help me any one.... ?
Try to start first the emulator. Navigate to the $SDK_ROOT/tools directory and execute the file 'emulator.exe'. Wait couple of minutes until it loads. Now run :
$adb install your_application.apk
If all went without errors then you should be seeing your newly installed APK on the emulator.