簡體   English   中英

使用PushPlugin不會為Android構建PhoneGap Build

[英]PhoneGap Build won't build for Android with PushPlugin

我們有一個PhoneGap應用程序,一旦我們添加PushPlugin就拒絕構建。

特別是在使用PhoneGap Build時,我們收到錯誤:

BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:573: ../../../../../../home/ec2-user/android-sdk/com.android.support:support-v4:+ resolve to a path with no project.properties file for project /project

在將PhoneGap( $ npm update -g phonegap )和PhoneGap Android平台( $ phonegap platform update android$ phonegap platform update android到最新版本之后,我們偶爾可以使用Ripple模擬器(在Visual Studio中構建)來構建它。

我們已經包含了這樣的插件:

<gap:plugin name="com.phonegap.plugins.pushplugin" /> 

或者,在Visual Studio 2015中構建時:

<vs:plugin name="com.phonegap.plugins.PushPlugin" version="2.5.0" src="https://github.com/phonegap-build/PushPlugin.git" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps" /> 

任何人都可以建議我們可能出錯的地方嗎?

編輯:

我們也試過在命令行上構建,但即使安裝了cordova-plugin-android-support-v4之后也是如此;

$ cordova plugin add cordova-plugin-android-support-v4
    Fetching plugin "cordova-plugin-android-support-v4" via npm
    npm http GET https://registry.npmjs.org/cordova-plugin-android-support-v4
    npm http 200 https://registry.npmjs.org/cordova-plugin-android-support-v4
    Installing "cordova-plugin-android-support-v4" for android

我們仍然會收到錯誤:

C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1>cordova build android
Running command: cmd "/s /c "C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\build.bat""
ANDROID_HOME=C:\Users\XXX\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\java\jdk1.7.0_55
Running: C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\gradlew cdvBuildDebug -b C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordova
dle.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-v4:+.
     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

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

C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c "C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\gradlew cdvBuildDebug -b C:\Dev\Cor
latforms\android\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
    at ChildProcess.whenDone (C:\Users\XXX\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134: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)

新的Push Plugin最近發布。 閱讀本文(通過官方博客),並獲取詳細信息:
http://simonmacdonald.blogspot.com/2015/07/phonegap-plugin-push-version-111.html

更新(2015-10-24):根據2015年9月28日的Phonegap Build博客
Android現在使用Gradle默認構建

Ant仍然可用,並可以強制使用 - 與
<preference name="android-build-tool" value="ant" />

發生其他相關更改,包括自動minSdkVersion版本控制9補丁圖像驗證 閱讀博客文章了解詳情。

注意: 在原始問題上,gradle(不受phonegap正式支持)是問題所在。 有些人通過強迫ant在其中運行來解決這個問題。 要查找其他帖子,請在此帖子中搜索30天; 主題與此類似,包括:“構建失敗”。

對於PhoneGap Build,請使用<gap:plugin name="com.phonegap.plugins.pushplugin" version="2.4.0" />強制它使用較舊的受支持版本。

嘗試刪除插件並使用以下命令通過命令行安裝它:

cordova plugin add com.phonegap.plugins.pushplugin --save

您會注意到插件將在config.xml中顯示如下:

<plugin name="com.phonegap.plugins.PushPlugin" spec="^2.2.1" />

但它不會在配置設計器上顯示,為此,在插件標簽前添加“vs:”:

<vs:plugin name="com.phonegap.plugins.PushPlugin" spec="^2.2.1" />

試試這個(不是100%的工作,但對我有用)。

在platforms / android / project.properties中刪除此行

cordova.system.library.1 = com.android.support:支持-V4:+

如果您使用的是facebook插件(像我一樣),您可以在下面忽略。

cordova插件添加android.support.v4

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM