我创建了一个cordova项目并按照以下方式构建:
cordova create /my_folder/FlugbuchFPG com.MyName.FlugbuchFPG FlugbuchFPG
cd /my_folder/FlugbuchFPG
cordova platform add android --save
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.MyName.FlugbuchFPG
Name: FlugbuchFPG
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android@6.1.2
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
Saved plugin info for "cordova-plugin-whitelist" to config.xml
--save flag or autosave detected
Saving android@~6.1.2 into config.xml file ...
Installed platforms:
android 6.1.2
Available platforms:
amazon-fireos ~3.6.3 (deprecated)
blackberry10 ~3.8.0
browser ~4.1.0
firefoxos ~3.6.3
ios ~4.3.0
osx ~4.0.1
webos ~3.7.0
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-17,android-18,android-19,android-20,android-21,android-22,android-23,android-N,android-25,Google Inc.:Google APIs:17,Google Inc.:Google APIs:18,Google Inc.:Glass Development Kit Preview:19,Google Inc.:Google APIs (x86 System Image):19,Google Inc.:Google APIs:19,Google Inc.:Google APIs:21,Google Inc.:Google APIs:22,Google Inc.:Google APIs:23
Gradle: installed
cordova build
ANDROID_HOME=/Users/myname/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
Subproject Path: CordovaLib
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:processDebugManifest
:CordovaLib:generateDebugBuildConfig
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:incrementalDebugJavaCompilationSafeguard
:CordovaLib:compileDebugJavaWithJavac
:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
:CordovaLib:mergeDebugJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
:CordovaLib:bundleDebug
:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugResValues
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:incrementalDebugJavaCompilationSafeguard
:compileDebugJavaWithJavac
:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:compileDebugNdk UP-TO-DATE
:compileDebugSources
:mergeDebugShaders
:compileDebugShaders
:generateDebugAssets
:mergeDebugAssets
:transformClassesWithDexForDebug
:mergeDebugJniLibFolders
:transformNative_libsWithMergeJniLibsForDebug
:processDebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug
:validateSigningDebug
:packageDebug
:assembleDebug
:cdvBuildDebug
BUILD SUCCESSFUL
Total time: 19.753 secs
Built the following apk(s):
/my_folder/FlugbuchFPG/platforms/android/build/outputs/apk/android-debug.apk
我将android-debug.apk下载到我的Android-Device,它运行正常。
然后我尝试将项目导入Eclipse 4.4.2。我选择 - >档案 - >导入... - > Android - >现有的Android代码进入工作区
Eclipse为我提供了6个包。我只选择" MainActivity"和" CordovaLib",因为所有其他人都有" debug"无论是在路径中还是在名称中。我重命名" MainAvtivity"我的应用程序的名称和" CordovaLib" to" ProjectnameCordovaLib"。
导入运行但项目因错误而标记为红色。当我转到"右键单击 - >属性 - > Java构建路径 - > Android Dependencies"它告诉我bin-Folder中缺少cordovalib.jar。实际上bin-Folder是完全空的。
当我从Android依赖项中删除条目时,其他错误仍然存在。所以这似乎不是解决方案。那么如何创建oder获取缺少的cordovalib.jar或以不同的方式解决此问题?感谢。
答案 0 :(得分:0)
如果其他人遇到此问题:
Finnaly我从我的硬盘驱动器中删除了所有的cordova项目,卸载了eclipse,下载了新版本的eclipse - 重要的是! - 选择不同的目录作为工作空间。看起来只是卸载并重新安装eclipse如果你使用相同的工作区没有帮助,因为eclipse不知何故会记住旧的工作区并且错误再次发生。在选择了一个新的工作区后,我重新生成了cordova项目并将它们导入eclispe,现在错误消失了,我可以构建应用程序。