繁体   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