Error while executing command "phonegap build android" in cmd - android

I've just installed Phonegap in my windows and created a helloWorld application. Now I want to create unsigned apk file for this. But there is no android platform in folder named platforms in the project directory.
That's why I reached this SO link for solution.
Now I'm following one of the answers and trying to execute the command phonegap build android. But it is giving me following errors in cmd.
I've opened this commands as administrator.
Error log:
C:\Users\Kaushal28\Documents\ooo>phonegap build android
[phonegap] executing 'cordova build android ' ...
ANDROID_HOME=C:\Users\Kaushal28\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111
Subproject Path: CordovaLib
Unzipping C:\Users\Kaushal28\.gradle\wrapper\dists\gradle-2.14.1- all\53l0mv9mggp9q5m2ip574m21oh\gradle-2.14.1-all.zip to C:\Users\Kaushal28\.gradle\wrapper\dists\gradle-2.14.1- all\53l0mv9mggp9q5m2ip574m21oh
Exception in thread "main"
java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager. java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
... 3 more
Error: cmd: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager. java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager. java:65)
... 3 more
What is the solution for this? Or I'm doing something wrong?
Thank you :)

Related

Gradle connectedCheck fails with 'No tests found' after migrating to AndroidX

I'm working on a multi-module project, and after making the transition from the support libraries to AndroidX, ./gradlew connectedCheck fails:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':MyProject:connectedDebugAndroidTest'.
> There were failing tests. See the report at: file:///Users/justinpollard/Dev/android-app/MyProject/build/reports/androidTests/connected/index.html
A bit further up, I see this message:
11:48:13 I/RemoteAndroidTest: Running am instrument -w -r com.myproject.test/androidx.test.runner.AndroidJUnitRunner on Pixel XL - 9
11:48:13 V/ddms: execute: running am instrument -w -r com.myproject.test/androidx.test.runner.AndroidJUnitRunner
11:48:15 V/InstrumentationResultParser: INSTRUMENTATION_RESULT: shortMsg=Process crashed.
11:48:15 I/InstrumentationResultParser: test run failed: 'Instrumentation run failed due to 'Process crashed.''
Starting 0 tests on Pixel XL - 9
Tests on Pixel XL - 9 failed: Instrumentation run failed due to 'Process crashed.'
11:48:15 I/XmlResultReporter: XML test result file generated at /Users/justinpollard/Dev/android-app/MyProject/build/outputs/androidTest-results/connected/TEST-Pixel XL - 9-MyProject-.xml. Total tests 0,
11:48:15 V/InstrumentationResultParser: INSTRUMENTATION_CODE: 0
11:48:15 V/InstrumentationResultParser:
11:48:15 V/ddms: execute 'am instrument -w -r com.myproject.test/androidx.test.runner.AndroidJUnitRunner' on 'HT73Y0200438' : EOF hit. Read: -1
11:48:15 V/ddms: execute: returning
com.android.builder.testing.ConnectedDevice > No tests found.[Pixel XL - 9] FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack #Test annotations).
This makes it seem like the failure is caused by a test apk crash before the tests can run. When I run one of my connected tests from Android Studio, I see a little more information:
2019-05-13 11:55:55.927 29839-29839/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myproject, PID: 29839
java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{com.myproject.test/androidx.test.runner.AndroidJUnitRunner}: java.lang.ClassNotFoundException: Didn't find class "androidx.test.runner.AndroidJUnitRunner" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/com.myproject.test-2MzWVeeaNLfexBOU_5tLPw==/base.apk", zip file "/data/app/com.myproject-Hd0c3YX8pUlOxZVK3mlgMA==/base.apk"],nativeLibraryDirectories=[/system/lib64, /vendor/lib64]]
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5855)
at android.app.ActivityThread.access$1100(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.runner.AndroidJUnitRunner" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/com.myproject.test-2MzWVeeaNLfexBOU_5tLPw==/base.apk", zip file "/data/app/com.myproject-Hd0c3YX8pUlOxZVK3mlgMA==/base.apk"],nativeLibraryDirectories=[/system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5851)
at android.app.ActivityThread.access$1100(ActivityThread.java:200) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:6718) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/runner/MonitoringInstrumentation;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 10 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.runner.MonitoringInstrumentation" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/com.myproject.test-2MzWVeeaNLfexBOU_5tLPw==/base.apk", zip file "/data/app/com.myproject-Hd0c3YX8pUlOxZVK3mlgMA==/base.apk"],nativeLibraryDirectories=[/system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 13 more
It's surprising to me that AndroidJUnitRunner and MonitoringInstrumentation are not found on the path since I include androidx.text:runner in the app-level build.gradle dependencies:
dependencies {
...
androidTestImplementation(
"androidx.test.ext:junit:1.1.0",
"androidx.test:rules:1.1.0",
"androidx.test:runner:1.1.0",
"androidx.test.espresso:espresso-core:3.1.0",
)
...
}
I've also made sure I'm following the instructions listed here at https://developer.android.com/training/testing/set-up-project:
1) My project build.gradle includes the google() repository (the instructions do say to include this in the app-level build.gradle, but I'm assuming that's incorrect given allprojects exists in the project-level build.gradle?)
2) I've got my dependencies listed in the app-level dependencies.androidTestImplementation (see above)
3) Add useLibrary 'android.test.runner' to the android section of my app build.gradle
4) Add <uses-library android:name="android.test.runner" android:required="false" /> to the app's AndroidManifest.xml (the instructions make it seem like this may not be required since I'm using gradle to run the tests)
For reference, without including an entire test, here's an illustrative example of my setup:
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.ext.junit.runners.AndroidJUnit4;
#RunWith(AndroidJUnit4.class)
public class ExampleTest {
#Before
public void setUp() throws Exception {
// Setup here
}
#After
public void tearDown() {
// Tear down here
}
#Test
public void testExample() {
// Test code here
}
...
}
Can anyone help me get these tests up and running again? Thanks!

Proguard error : No such file or directory

I am receiving this exception while creation of signed apk of my application.
Proguard returned with error code 1. See console
java.io.IOException: Can't read [C:\Users\xx\Desktop\APP\xx\Users\imac\Amit\Workspace\xx\libs\universal-image-loader-1.9.4.jar] (No such file or directory)
at proguard.InputReader.readInput(InputReader.java:230)
at proguard.InputReader.readInput(InputReader.java:200)
at proguard.InputReader.readInput(InputReader.java:178)
at proguard.InputReader.execute(InputReader.java:100)
at proguard.ProGuard.readInput(ProGuard.java:196)
at proguard.ProGuard.execute(ProGuard.java:78)
at proguard.ProGuard.main(ProGuard.java:492)
Caused by: java.io.IOException: No such file or directory
at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:50)
at proguard.InputReader.readInput(InputReader.java:226)
... 6 more

Cordova: Error in adding android platform

I tried to add android platform but got an error. I don't know what it is.
Android project created with cordova-android#6.0.0
Installing "cordova-plugin-battery-status" for android
ANDROID_HOME=C:\Users\MariaLigayahin\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111
Subproject Path: CordovaLib
Unzipping C:\Users\MariaLigayahin\.gradle\wrapper\dists\gradle-2.14.1-all\53l0mv9mggp9q5m2ip574m21oh\gradle-2.14.1-all.zip to C:\Users\MariaLigayahin\.gradle\wrapper\dists\gradle-2.14.1-all\53l0mv9mggp9q5m2ip574m21oh
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
... 3 more
Failed to install 'cordova-plugin-battery-status':Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (D:\MariaLigayahin\Desktop\android_app\Helloworld\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Error: cmd: Command failed with exit code 1
Already tried removing and then adding again. Any help would be much appreciated.

ionic example fails (android)

I followed the instruction very carefully, yet could not make build the android version. I'm getting this:
Error: /Users/ali/cream/myApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: zip file is empty
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.util.zip.ZipException: zip file is empty
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:215)
at java.util.zip.ZipFile.<init>(ZipFile.java:145)
at java.util.zip.ZipFile.<init>(ZipFile.java:159)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
... 3 more
Can someone help me.

Cordova Run Error - Proxy?

I'm on Windows 7, I set all my proxies. As you can see it fails with error code 8, but anything I search for seems not to match my problem exactly.
When I try to build and run my app in cordova, I get this error. I have no idea what to do! Any advice? Thanks everyone!
C:\Users\310202751\Documents\CordovaProjects\Locator>cordova run
Running command: cmd "/s /c "C:\Users\310202751\Documents\CordovaProjects\Locato
r\platforms\android\cordova\run.bat""
ANDROID_HOME=C:\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_45
WARNING : No target specified, deploying to device '84deb82e'.
Running: C:\Users\310202751\Documents\CordovaProjects\Locator\platforms\android\
gradlew cdvBuildDebug -b C:\Users\310202751\Documents\CordovaProjects\Locator\pl
atforms\android\build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true
Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip
Exception in thread "main" java.lang.RuntimeException: java.net.ConnectException
: Connection refused: connect
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketI
mpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja
va:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocket
Impl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java
:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
at sun.net.www.http.HttpClient.New(HttpClient.java:308)
at sun.net.www.http.HttpClient.New(HttpClient.java:326)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
onnection.java:1168)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConn
ection.java:1104)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:998)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:932)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLCo
nnection.java:1512)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1440)
at org.gradle.wrapper.Download.downloadInternal(Download.java:59)
at org.gradle.wrapper.Download.download(Download.java:45)
at org.gradle.wrapper.Install$1.call(Install.java:60)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:65)
... 3 more

Categories

Resources