Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

After installing this plugin I can't build on Android #141

Closed
adantart opened this issue Sep 15, 2015 · 35 comments
Closed

After installing this plugin I can't build on Android #141

adantart opened this issue Sep 15, 2015 · 35 comments

Comments

@adantart
Copy link

It says:

Running command: /home/myapp/platforms/android/cordova/build 
ANDROID_HOME=/Applications/ADT/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
Running: /home/myapp/platforms/android/gradlew cdvBuildDebug -b /home/myapp/platforms/android/build.gradle -Dorg.gradle.daemon=true

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.android.support:support-v13:23+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/support-v13/maven-metadata.xml
         https://repo1.maven.org/maven2/com/android/support/support-v13/
         file:/Applications/ADT/sdk/extras/android/m2repository/com/android/support/support-v13/maven-metadata.xml
         file:/Applications/ADT/sdk/extras/google/m2repository/com/android/support/support-v13/maven-metadata.xml
         file:/Applications/ADT/sdk/extras/google/m2repository/com/android/support/support-v13/
     Required by:
         :android:unspecified

* 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.109 secs

/home/myapp/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /home/myapp/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/myapp/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/myapp/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /home/myapp/platforms/android/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139: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 to change config.xml since I heard in other issue it can be about minsdk, but my Cordova is 5.3.1 and I set minsdk to 20, 21, 22 ... but again the same problems.

BTW, I read about #136 and:

  1. I don't have any file in android named "android-support-*.jar"
  2. I already have in my build-extras.gradle at /platforms/android/ the:
    dependencies {
    compile "com.android.support:support-v13:23+"
    }

Thank you

@adantart
Copy link
Author

I went to Android Studio and update everything and it's working ;-)
easy !

@alexbuijs
Copy link

If you're installing only the neccessary sdk tools by hand like me, this did the trick for me:

android update sdk --no-ui --all --filter "extra-android-m2repository"

@nhiendat
Copy link

After run SDK manager and update for Android Support Repository, Android Support Library then it's work :)

@madhu-ra
Copy link

I looked at the place where it specifying in the error message for available support-v13 versions(folders). In my case latest one was 22.2.0. So in the package.xml file(root/plugins/phonegap-plugin-push/package.xml) I replaced the

<framework src="com.android.support:support-v13:23+" />

into

<framework src="com.android.support:support-v13:22.2.0" />

Working as expected

@fredgalvao
Copy link
Collaborator

You shouldn't change the version of the dependencies of a plugin, that could lead to unexpected behaviour if that plugin expects a feature only available in newer versions. You should instead update your android sdk, more specifically Android Support Repository and Android Support Library as pictured here.

You're fine on this one, however, as this plugin (phonegap-plugin-push) doesn't use any of the new features on 23+ (yet).

@autonomous1
Copy link

After removing this plugin it still leaves residual garbage in plugins/android.json, platforms/android/AndroidManifest.xml, platforms/android/build.gradle and platforms/android/project.properties. Removing all references to com.android.support:support-v13:23+ in platforms/android/project.properties and platforms/android/build.gradle fixed the issue with not being able to build project.

@fredgalvao
Copy link
Collaborator

@autonomous1 That's an issue with cordova-cli by the way, you might want to create an issue at https://issues.apache.org/jira/browse/CB.

@TimmyCarbone
Copy link

This did the trick for me too :

android update sdk --no-ui --all --filter "extra-android-m2repository"

@imVinayPandya
Copy link

exact solution i found for me is that:

you need to install
Android Support Library
Android Support Repository
Google Play Services

means you need to install/update your SDK extra facilities whic you can do with command line its easy.

android update sdk --no-ui --filter extra.

@NaurozAhmad
Copy link

Updating still didn't solve my problem.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.google.android.gms:play-services-gcm:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/
         file:/home/user/android/extras/android/m2repository/com/google/android/gms/play-services-gcm/maven-metadata.xml
         file:/home/user/android/extras/android/m2repository/com/google/android/gms/play-services-gcm/
     Required by:
         :android:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

@jzaric
Copy link

jzaric commented Feb 8, 2016

@NaurozAhmad I assume you've already found the solution. But for others to see as well.
After installing:
Android Support Library
Android Support Repository
Google Play Services

as noted above, try installing "Google Repository" as well. This solved the issue for me.

@adybionka
Copy link

After spending 2h on trying build apk with phonegap-plugin-push plugin I found solution.

  1. In config.xml of your cordova project (in your main directory), just edit or add this line:
    <preference name="android-targetSdkVersion" value="23"/>
  2. Then remove android platform:
    cordova platform add android
  3. And add it again:
    phonegap platform add android

@Kostanos
Copy link

Kostanos commented Mar 4, 2016

Thank you @alexbuijs

@ajeesh13
Copy link

ajeesh13 commented Mar 5, 2016

This did the trick for me too :
android update sdk --no-ui --all --filter "extra-android-m2repository"

I have run this command on the android sdk root folder

@ABarak64
Copy link

In case anyone still finds this thread with the same issue and is like "but it still won't compile!" my problem was that I was updating my android sdk via Program Files rather than Program Files x86, which is where Cordova was looking for the sdks.

@devkiran
Copy link

Thank you @alexbuijs

@vukasin-nikodijevic
Copy link

For me next worked:

  • Added target version to 23 and changed minimal version to 22 - those values can be tuned by particular scenario.
  • Added Google Repositories from extras - actually install all extras 😄
  • run: android update sdk --no-ui --all --filter "extra-android-m2repository"
  • ionic build android worked

@mhnvala
Copy link

mhnvala commented Jul 26, 2016

thanks @alexbuijs

@sungsong88
Copy link

sungsong88 commented Jul 27, 2016

If any of these didn't solve the problem, try to recreate android platform. Make sure you back up the important stuff, and simply cordova platform rm android, then cordova platform add android.

This worked for me.

I think installing Android Support Library (Obsolete) from SDK manager while there is a platform already causes the problem in my case.

@petronetto
Copy link

Run android update sdk --no-ui --all --filter "extra-android-m2repository" and installing Google Repository, solved the issue for me

@tarto-dev
Copy link

Running android update sdk --no-ui --all --filter "extra-android-m2repository" and install every Extras solved the issue for me.

@zubaer-ahammed
Copy link

I ran into the same issue and did the following to resolve it.

  1. I ran: android update sdk --no-ui --all --filter "extra-android-m2repository"
  2. Then I installed "Google Play Services" and "Google Repository"

Note: Instead of running the command above, you can install "Android Support Repository" by opening Android SDK Manager.

@cristovao-trevisan
Copy link

My problem was a little bit different so fixing the SDK didn't solve the issue, I tried fixing the JDK and it worked for me. On Ubuntu terminal type:
sudo apt-get remove oracle-java8-installer
sudo apt-get install oracle-java8-installer

@nagasaikrishna
Copy link

android update sdk --no-ui --all --filter "extra-android-m2repository"
Worked for me as well
Thankyou

@dfa1234
Copy link

dfa1234 commented Nov 23, 2016

I had to do not only
android update sdk --no-ui --all --filter "extra-android-m2repository"
but also
android update sdk --no-ui --filter extra
to make it work like said by @imVinayPandya
and finally in my case: to set a min-sdk preference in my config.xml file

@DNAngeluS
Copy link

@cristovao-trevisan Thanks!!! no one tells you but apparently you CAN'T use openjdk with cordova, or at least it need more configuration. My problem was obtaining a certificate from sun that make the whole platform add fail.

For those looking how to install oracle java on ubuntu,
https://help.ubuntu.com/community/Java

@alexbuijs
Copy link

@DNAngeluS This is (part of) the docker file I use for installing OpenJDK 8 and the Android tools necessary for building APK's with Cordova:

FROM node:7.2.0
ENV SDK_HOME /opt/android-sdk
ENV ANDROID_SDK_VERSION 25.2.2
ENV ANDROID_API_LEVEL 25
ENV ANDROID_BUILD_TOOLS_VERSION 25.0.0
ENV ANDROID_SDK_DIST tools_r${ANDROID_SDK_VERSION}-linux.zip
ENV ANDROID_SDK_TOOLS android-${ANDROID_API_LEVEL},build-tools-${ANDROID_BUILD_TOOLS_VERSION},extra-android-m2repository,extra-google-m2repository
ENV PATH $PATH:$SDK_HOME/tools
RUN echo "deb http://ftp.de.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/openjdk.list
RUN apt-get update
RUN apt-get install -y openjdk-8-jdk lib32stdc++6 lib32z1 unzip
RUN wget http://dl.google.com/android/repository/${ANDROID_SDK_DIST}
RUN mkdir -p $SDK_HOME
RUN unzip $ANDROID_SDK_DIST -d $SDK_HOME
RUN rm $ANDROID_SDK_DIST
RUN echo y | android update sdk -u -a -t $ANDROID_SDK_TOOLS

@DNAngeluS
Copy link

Thanks @alexbuijs !!! I was building my own just to avoid dealing with these again. I think I'll use part of that code.

@jessicastorm1986
Copy link

How can i run this code, it is not working from command prompt - android update sdk --no-ui --all --filter "extra-android-m2repository"

@BradyNadeau
Copy link

@jessicastorm1986 Make sure your path variables are correct for your android SDK.

@jessicastorm1986
Copy link

jessicastorm1986 commented Jan 31, 2017

@BradyLiles , i am ableto make an export without this plugin, but after adding this it is giving me error, my paths are correct though [see attached file]

ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111
Subproject Path: CordovaLib
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Incremental java compilation is an incubating feature.

error-
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'android'.

Could not resolve all dependencies for configuration ':_debugApkCopy'.
Could not find any matches for com.google.firebase:firebase-core:+ as no versions of com.google.firebase:firebase-core
are available.
Required by:
:android:unspecified
Could not find any matches for com.google.firebase:firebase-messaging:+ as no versions of com.google.firebase:firebase-
messaging are available.
Required by:
:android:unspecified
Could not find any matches for com.google.firebase:firebase-crash:+ as no versions of com.google.firebase:firebase-cras
h are available.
Required by:
:android:unspecified
Could not find any matches for com.google.firebase:firebase-config:+ as no versions of com.google.firebase:firebase-con
fig are available.
Required by:
:android:unspecified

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

asdk

@MZabih
Copy link

MZabih commented Mar 15, 2017

i've just restarted my machine and problem solved :P

@dpardox
Copy link

dpardox commented May 10, 2017

This did the trick for me too in git console.

android.bat update sdk --no-ui --all --filter "extra-android-m2repository"

cordova-plugin-camera

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.android.support:support-v4:24.1.1+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml

         https://repo1.maven.org/maven2/com/android/support/support-v4/
     Required by:
         :android:unspecified

@Mohit-069
Copy link

Hello guys i am new on IONIC 2 I implemented native facebook login in my ionic 2 app. for this i add cordova-plugin-facebook4. and follow all the instruction from this link: https://ionicthemes.com/tutorials/about/ionic2-facebook-login after follow all the instruction when i run command to make android apk it give me error build faild. for this i update my android. but till now this error do not solve and not make apk file please help me.

@lock
Copy link

lock bot commented Jun 3, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests