gpt4 book ai didi

java - Cordova 本地构建因应用程序大小而失败?

转载 作者:行者123 更新时间:2023-12-01 13:11:56 25 4
gpt4 key购买 nike

我有一个应用程序总共使用 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 文件...... 包 com.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 可以解决问题。

关于java - Cordova 本地构建因应用程序大小而失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22788183/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com