phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

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

Closed adantart closed 9 years ago

adantart commented 9 years ago

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 commented 9 years ago

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

alexbuijs commented 9 years ago

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 commented 9 years ago

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

madhu-ra commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

@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 commented 8 years ago

This did the trick for me too :

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

imVinayPandya commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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 commented 8 years ago

Thank you @alexbuijs

ajeesh13 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

Thank you @alexbuijs

vukasin-nikodijevic commented 8 years ago

For me next worked:

mhnvala commented 8 years ago

thanks @alexbuijs

sungsong88 commented 8 years ago

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 commented 8 years ago

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

tarto-dev commented 8 years ago

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

zubaer-ahammed commented 8 years ago

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 commented 8 years ago

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 commented 7 years ago

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

dfa1234 commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

@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 commented 7 years ago

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

jessicastorm1986 commented 7 years ago

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

BradyNadeau commented 7 years ago

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

jessicastorm1986 commented 7 years ago

@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.

BUILD FAILED

asdk

MZabih commented 7 years ago

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

dpardox commented 7 years ago

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 commented 7 years ago

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[bot] commented 6 years ago

This thread has been automatically locked.