CordovaLib不包括:ant debug

时间:2014-12-08 11:27:42

标签: android cordova ant command-line

我创建了一个基本的Cordova android应用程序并尝试使用ant构建应用程序。但 CordovaLib 源在应用程序中未包含。以下是构建消息。

  D:\SampleApp\platforms\android>android update project --path . --subprojects --library CordovaLib --target 1
  Resolved location of library project to: D:\SampleApp\platforms\android\CordovaLib
  Updated project.properties
  Updated local.properties
  Updated file D:\SampleApp\platforms\android\proguard-project.txt
  Updated project.properties
  Updated local.properties
  Updated file D:\SampleApp\platforms\android\bin\proguard-project.txt
  Updated project.properties
  Updated local.properties
  Updated file D:\SampleApp\platforms\android\CordovaLib\proguard-project.txt

  D:\SampleApp\platforms\android>ant debug
  Buildfile: D:\SampleApp\platforms\android\build.xml

  -set-mode-check:

  -set-debug-files:

  -check-env:
  [checkenv] Android SDK Tools Revision 23.0.2
  [checkenv] Installed at C:\Users\user\AppData\Local\Android\android-sdk

 -setup:
  [echo] Project Name: CordovaApp
  [gettype] Project Type: Application

 -set-debug-mode:

 -debug-obfuscation-check:

 -pre-build:

 -build-setup:
 [getbuildtools] Using latest Build Tools: 20.0.0
 [echo] Resolving Build Target for CordovaApp...
 [gettarget] Project Target:   Android 4.4.2
 [gettarget] API level:        19
 [echo] ----------
 [echo] Creating output directories if needed...
[mkdir] Created dir: D:\SampleApp\platforms\android\bin\rsObj
[mkdir] Created dir: D:\SampleApp\platforms\android\bin\rsLibs
 [echo] ----------
 [echo] Resolving Dependencies for CordovaApp...
 [dependency] Library dependencies:
 [dependency]
 [dependency] ------------------
 [dependency] Ordered libraries:
 [dependency]
 [dependency] ------------------
 [echo] ----------
 [echo] Building Libraries with 'debug'...

 nodeps:

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK Tools Revision 23.0.2
[checkenv] Installed at C:\Users\user\AppData\Local\Android\android-sdk

 -setup:
 [echo] Project Name: CordovaLib
 [gettype] Project Type: Android Library

 -set-debug-mode:

 -debug-obfuscation-check:

 -pre-build:

 -build-setup:
 [getbuildtools] Using latest Build Tools: 20.0.0
 [echo] Resolving Build Target for CordovaLib...
 [gettarget] Project Target:   Android 4.4.2
 [gettarget] API level:        19
 [echo] ----------
 [echo] Creating output directories if needed...
 [mkdir] Created dir: D:\SampleApp\platforms\android\CordovaLib\bin\rsObj
 [mkdir] Created dir: D:\SampleApp\platforms\android\CordovaLib\bin\rsLibs
 [echo] ----------
 [echo] Resolving Dependencies for CordovaLib...
 [dependency] Library dependencies:
 [dependency] No Libraries
 [dependency]
 [dependency] ------------------

 -code-gen:
 [mergemanifest] Found Deleted Target File
 [mergemanifest] Merging AndroidManifest files into one.
 [mergemanifest] Manifest merger disabled. Using project manifest only.
 [echo] Handling aidl files...
 [aidl] No AIDL files to compile.
 [echo] ----------
 [echo] Handling RenderScript files...
 [echo] ----------
 [echo] Handling Resources...
 [aapt] Found new input file
 [aapt] Generating resource IDs...
 [echo] ----------
 [echo] Handling BuildConfig class...
 [buildconfig] No need to generate new BuildConfig.

 -pre-compile:

 -compile:
 [echo] Creating library output jar file...

 -post-compile:

 -obfuscate:

 -dex:
 [echo] Library project: do not convert bytecode...

 -crunch:
 [crunch] Crunching PNG Files in source dir: D:\SampleApp\platforms\android\CordovaLib\res
 [crunch] To destination dir: D:\SampleApp\platforms\android\CordovaLib\bin\res
 [crunch] Crunched 0 PNG files to update cache

 -package-resources:
 [echo] Library project: do not package resources...

 -package:
 [echo] Library project: do not package apk...

 -post-package:

 -do-debug:
 [echo] Library project: do not create apk...
 [propertyfile] Updating property file: D:\SampleApp\platforms\android\CordovaLib\bin\build.prop
 [propertyfile] Updating property file: D:\SampleApp\platforms\android\CordovaLib\bin\build.prop
 [propertyfile] Updating property file: D:\SampleApp\platforms\android\CordovaLib\bin\build.prop
 [propertyfile] Updating property file: D:\SampleApp\platforms\android\CordovaLib\bin\build.prop

 -post-build:

 debug:

 -code-gen:
 [mergemanifest] Found Deleted Target File
 [mergemanifest] Merging AndroidManifest files into one.
 [mergemanifest] Manifest merger disabled. Using project manifest only.
 [echo] Handling aidl files...
 [aidl] No AIDL files to compile.
 [echo] ----------
 [echo] Handling RenderScript files...
 [echo] ----------
 [echo] Handling Resources...
 [aapt] Found Deleted Target File
 [aapt] Generating resource IDs...
 [echo] ----------
 [echo] Handling BuildConfig class...
 [buildconfig] Generating BuildConfig class.

 -pre-compile:
 [echo] Set jars path to: D:\SampleApp\platforms\android\CordovaLib\ant-build\classes.jar

 -compile:
[javac] Compiling 3 source files to D:\SampleApp\platforms\android\bin\classes
[javac] D:\SampleApp\platforms\android\src\com\example\sampleapp\CordovaApp.java:23: error:      
package org.apache.cordova does not exist 
[javac] import org.apache.cordova.*;
[javac] ^
[javac] D:\SampleApp\platforms\android\src\com\example\sampleapp\CordovaApp.java:25: error: cannot find symbol
[javac] public class CordovaApp extends CordovaActivity
[javac]                                 ^
[javac]   symbol: class CordovaActivity
[javac] D:\SampleApp\platforms\android\src\com\example\sampleapp\CordovaApp.
java:30: error: cannot find symbol
[javac]         super.onCreate(savedInstanceState);
[javac]         ^
[javac]   symbol:   variable super
[javac]   location: class CordovaApp
[javac] D:\SampleApp\platforms\android\src\com\example\sampleapp\CordovaApp.
java:31: error: cannot find symbol
[javac]         super.init();
[javac]         ^
[javac]   symbol:   variable super
[javac]   location: class CordovaApp
[javac] D:\SampleApp\platforms\android\src\com\example\sampleapp\CordovaApp.
java:33: error: cannot find symbol
[javac]         loadUrl(launchUrl);
[javac]                 ^
[javac]   symbol:   variable launchUrl
[javac]   location: class CordovaApp
[javac] D:\SampleApp\platforms\android\src\com\example\sampleapp\CordovaApp.
java:27: error: method does not override or implement a method from a supertype
[javac]     @Override
[javac]     ^
[javac] 6 errors

BUILD FAILED
C:\Users\user\AppData\Local\Android\android-sdk\tools\ant\build.x
ml:720: The following error occurred while executing this line:
C:\Users\user\AppData\Local\Android\android-sdk\tools\ant\build.x
ml:734: Compile failed; see the compiler error output for details.

Total time: 2 seconds

D:\SampleApp\platforms\android>

此构建失败的主要原因是CordovaLib未正确包含在Cordova项目中。如何通过ant命令包含库?

0 个答案:

没有答案