当我将我的cordova插件添加到我的项目并运行“cordova run android”时,我收到此错误,我不知道如何继续:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Unable to find source java class: ‘/home/marcelo/Documents/Delicia-e-Foco/app/platforms/android/app/src/main/java/main/java/com/pagseguroCordova/PagseguroCordova.java’ because it does not belong to any of the source dirs: ‘[/home/marcelo/Documents/Delicia-e-Foco/app/platforms/android/app/src/main/java, /home/marcelo/Documents/Delicia-e-Foco/app/platforms/android/app/src/debug/java, /home/marcelo/Documents/Delicia-e-Foco/app/platforms/android/app/build/generated/source/r/debug, /home/marcelo/Documents/Delicia-e-Foco/app/platforms/android/app/build/generated/source/buildConfig/debug, /home/marcelo/Documents/Delicia-e-Foco/app/platforms/android/app/build/generated/source/aidl/debug, /home/marcelo/Documents/Delicia-e-Foco/app/platforms/android/app/build/generated/source/rs/debug]’
已经尝试修改我的plugin.xml.这是plugin.xml:
<?xml version="1.0" encoding="UTF-8"?> <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-pagseguro" version="1.0.0"> <js-module src="./www/plugin.js" name="plugin"> emphasized text<clobbers target="PagseguroCordova" /> </js-module> <!-- android --> <platform name="android"> <config-file target="res/xml/config.xml" parent="/*"> <feature name="pagseguroCordova" > <param name="android-package" value="com.example.pagseguroCordova"/> </feature> </config-file> <framework src="build.gradle" custom="true" type="gradleReference" /> <framework src='br.uol.pagseguro.client:btserial:1.1.0' /> <framework src='br.uol.pagseguro.client:plugpag:1.1.0' /> <source-file src="src/android/PagseguroCordova.java" target-dir="src/main/java/com/pagseguroCordova/" /> </platform>
我正在使用gradle导入dependecies,这是我的build.gradle文件:
repositories { jcenter() maven { url 'https://github.com/pagseguromaster/plugpag/raw/master/android' } } dependencies { compile 'br.uol.pagseguro.client:btserial:1.1.0' compile 'br.uol.pagseguro.client:plugpag:1.1.0' }
有人知道导致这个错误的原因是什么?感谢您的关注.
删除.idea和.gradle文件夹对我有用.下次启动时,在Android Studio中打开项目文件夹,它应该重新创建它们.
然而它然后给了我Android Studio: “Please select Android SDK”对话框.
修复我的是:文件 – >项目结构 – > (模块)App – > BuildToolsVersion – >
…然后(奇怪地)单击以打开下拉菜单,然后单击已选择的完全相同的项目.
然后重建.
排序,谷歌!
(Android Studio 3.1.2)