科尔多瓦建设|运行失败 - compileDebugJavaWithJavac [英] Cordova build | Run failed - compileDebugJavaWithJavac
问题描述
我在 Apache Cordova 上建立 Android平台时遇到问题。
I have a problem with building my Android platform on Apache Cordova.
版本号:
- Android @ 5.0.1(Samsung galaxy S4)
- Cordova @ 6.1.1(于07/04/2016从5.1.1更新)
- Ionic @ 1.7.14
- Windows @ 7
- Android @5.0.1 (Samsung galaxy S4)
- Cordova @6.1.1 (updated from 5.1.1 on 07/04/2016)
- Ionic @1.7.14
- Windows @7
我可以昨天构建我的项目,但是从今天开始,运行我的cordova应用程序。我试图删除和添加我的Android平台,但那没有工作(它只是做的事情更糟糕)。
I could build my project yesterday, but since today I get errors when trying to build or run my cordova app. I have tried to remove and add my android platform, but that didn't work (it only made thing worse).
执行失败
当我执行 Cordova build android 或 Cordova run android 时出现以下错误:
When I run "Cordova build android" or "Cordova run android" I get the following error:
任务':CordovaLib:compileDebugJavaWithJavac'的执行失败。
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
编译失败;有关详细信息,请参阅编译器错误输出。
Compilation failed; see the compiler error output for details.
stacktrace提供以下内容:
The stacktrace gives the following:
:CordovaLib:compileDebugJavaWithJavac C:\Users\me\Desktop\myProjects\testProject\platforms\android\CordovaLib\src\org\apache\ cordova \CordovaInterfaceImpl.java:222:错误:找不到符号getActivity()。requestPermissions(permissions,requestCode);
:CordovaLib:compileDebugJavaWithJavac C:\Users\me\Desktop\myProjects\testProject\platforms\android\CordovaLib\src\org\apache\cordova\CordovaInterfaceImpl.java:222: error: cannot find symbol getActivity().requestPermissions(permissions, requestCode);
似乎解决这个错误。我在我的环境变量中有一个有效的java路径,并且我已安装以下 Android SDK构建工具:
I cannot seem to resolve this error. I have a valid java path in my environment variables and I have installed the following Android SDK build tools:
- 23.0.3
- 23.0.2
- 23.0.1
- 22.0.1
- 21.1.2
- 20
- 19.1
- 23.0.3
- 23.0.2
- 23.0.1
- 22.0.1
- 21.1.2
- 20
- 19.1
我尝试的
android@5.0.1 ,但这会给我未知的平台版本。因此,我必须在 Android清单和 project.properties 中手动将其设置为版本21。
I tried cordova platform add android@5.0.1, but that gives me unknown platform version. So I have to set it to version 21 manually in the Android manifest and project.properties.
此外,如果我运行
Also if I run cordova platform add android@5.1.1 cordova somehow overrides this and installs the platform for android version 23 (6.0).
我尝试降级到Cordova版本5.1.1,但仍然给了我相同的错误。
I tried downgrading to Cordova version 5.1.1, but that still gave me the same error.
我尝试更改Java路径,没有结果。
I tried changing the Java path, with no result.
我更新了Android SDK工具和Android SDK平台工具,没有区别。
I updated my Android SDK tools and Android SDK platform tools, No difference.
解决方案
似乎我的npm_cache已损坏。我不得不删除它,所以它是由科尔多瓦重新创建。之后,我可以再次构建和运行。
文件位置: C:\Users\.cordova\lib
,然后删除npm_cache文件夹。
It seemed that my npm_cache was corrupt. I had to remove it, so that it was recreated by Cordova. After this I could build and run again. File location: C:\Users\.cordova\lib and then remove the npm_cache folder.
推荐答案
您的Android平台模板可能有问题。尝试删除用于缓存平台文件的users / user / .cordova / lib / npm_cache文件夹。
There might be something wrong with your android platform template. Try deleting "users/user/.cordova/lib/npm_cache" folder,which caches your platform files.
然后,删除项目的平台并再次添加。
After that, remove the platform of your project and add it again.
这篇关于科尔多瓦建设|运行失败 - compileDebugJavaWithJavac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!