我有一个应用程序,它总共使用 50M 来保存所有 UI 和实际构建。然后我有一个文件夹"platforms/android/res/raw",我在其中添加我的视频文件。我有 6 个视频文件,总和为 110M,因此我们总共有 160M + cordova。
当我的原始文件夹只有 1 个视频时,我可以编译它并取出 apk。当我将所有 6 个视频都保留在那里时,我的 ant 调试立即失败。我不认为这是代码问题,但也许是配置(用于编译容量),还是我?可能是我,不得不说。
所以当我去的时候
ant debug -f "/Users/ed/Desktop/Projects/Local/XXX/platforms/android/build.xml"
我得到这个输出
Eds-Mac-mini:XXX ed$ ant debug -f "/Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/build.xml"
Buildfile: /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/build.xml
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 22.3.0
[checkenv] Installed at /Users/ed/Eclipse/sdk
-setup:
[echo] Project Name: XXX
[gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 19.0.1
[echo] Resolving Build Target for XXX...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[echo] ----------
[echo] Resolving Dependencies for XXX...
[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 22.3.0
[checkenv] Installed at /Users/ed/Eclipse/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: 19.0.1
[echo] Resolving Build Target for CordovaLib...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[echo] ----------
[echo] Resolving Dependencies for CordovaLib...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
-code-gen:
[mergemanifest] No changes in the AndroidManifest files.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] No changed resources. R.java and Manifest.java untouched.
[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: /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/CordovaLib/res
[crunch] To destination dir: /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/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: /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/CordovaLib/bin/build.prop
[propertyfile] Updating property file: /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/CordovaLib/bin/build.prop
[propertyfile] Updating property file: /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/CordovaLib/bin/build.prop
[propertyfile] Updating property file: /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/CordovaLib/bin/build.prop
-post-build:
debug:
-code-gen:
[mergemanifest] No changes in the AndroidManifest files.
[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:
[javac] Compiling 1 source file to /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/bin/classes
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:17: <identifier> expected
[javac] public static final int 1=0x7f040000;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:17: illegal start of type
[javac] public static final int 1=0x7f040000;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:17: <identifier> expected
[javac] public static final int 1=0x7f040000;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:18: <identifier> expected
[javac] public static final int 2=0x7f040001;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:18: illegal start of type
[javac] public static final int 2=0x7f040001;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:18: <identifier> expected
[javac] public static final int 2=0x7f040001;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:19: <identifier> expected
[javac] public static final int 3=0x7f040002;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:19: illegal start of type
[javac] public static final int 3=0x7f040002;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:19: <identifier> expected
[javac] public static final int 3=0x7f040002;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:20: <identifier> expected
[javac] public static final int 4=0x7f040003;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:20: illegal start of type
[javac] public static final int 4=0x7f040003;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:20: <identifier> expected
[javac] public static final int 4=0x7f040003;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:21: <identifier> expected
[javac] public static final int 5=0x7f040004;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:21: illegal start of type
[javac] public static final int 5=0x7f040004;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:21: <identifier> expected
[javac] public static final int 5=0x7f040004;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:22: <identifier> expected
[javac] public static final int 6=0x7f040005;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:22: illegal start of type
[javac] public static final int 6=0x7f040005;
[javac] ^
[javac] /Users/ed/Desktop/Projects/Local/kiosk_cordova/XXX/platforms/android/gen/com/xxx/kiosk/R.java:22: <identifier> expected
[javac] public static final int 6=0x7f040005;
[javac] ^
[javac] 18 errors
BUILD FAILED
/Users/ed/Eclipse/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Users/ed/Eclipse/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 4 seconds
所以从我收集到的 R.java 文件来看,它正在苦苦挣扎,所以这是我的 R.java 文件...... 包裹通讯 xxx.kiosk;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class raw {
public static final int 1=0x7f040000;
public static final int 2=0x7f040001;
public static final int 3=0x7f040002;
public static final int 4=0x7f040003;
public static final int 5=0x7f040004;
public static final int 6=0x7f040005;
}
public static final class string {
public static final int app_name=0x7f050000;
}
public static final class style {
public static final int XXX=0x7f060000;
}
public static final class xml {
public static final int config=0x7f030000;
}
}
项目名称不是XXX,而是被替换的,所以如果有人认为XXX是原因,那就不是了。
好的,我终于弄清楚了问题所在。如果有人也得到这个,请小心。
显然,Cordova创建了这个类并根据文件名创建变量。我的视频文件被称为 1.mp4;2.mp4;3.mp4 等。如您所知,类方法/变量不能以 0-9 开头,在 0-9 前面添加 a-z 可以解决这个问题。