2

I'm using ionic and I run ionic build android. The following error appears.

:CordovaLib:compileDebugJava/Users/jasontanner/Documents/ion/fip/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java:31: error: package org.apache.http.util does not exist
import org.apache.http.util.EncodingUtils;
                           ^
/Users/jasontanner/Documents/ion/fip/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java:430: error: cannot find symbol
        byte[] data = base64 ? Base64.decode(dataPartAsString, Base64.DEFAULT) : EncodingUtils.getBytes(dataPartAsString, "UTF-8");
                                                                                 ^
  symbol:   variable EncodingUtils
  location: class CordovaResourceApi
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib: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: 2.663 secs

/Users/jasontanner/documents/ion/fip/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /Users/jasontanner/documents/ion/fip/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/jasontanner/documents/ion/fip/platforms/android/build.gradle,-Dorg.gradle.daemon=true

I've adjusted the appropriate files to run on Android 22 SDK. Outside of that, I've made no other changes to the android code. Any help on how to fix this would be awesome. Thanks!

thank_you
  • 11,001
  • 19
  • 101
  • 185

2 Answers2

6

Try making sure you have updated all of your libraries (ionic, cordova and so on) by running npm update. If this doesn't work I would check you have the latest JDK installed.

Finally try removing then re-adding the android platform from your project with the following commands

  • ionic platform remove android
  • ionic platform add android

If your using a mac, you could also try running the build command as sudo eg sudo ionic build android. I have come accross this when the libraries (such as ionic and cordova) have been installed with sudo. You can see more at npm throws error without sudo. Look into the NVM option which is the best way to move forward.

Community
  • 1
  • 1
SM3RKY
  • 1,548
  • 1
  • 14
  • 27
0

Could not find any version that matches com.android.support:support-v4:24.1.1+.

Solved it through reinstall of the whole Android support repository in Android SDK. It may crash.

Dimitar
  • 4,402
  • 4
  • 31
  • 47