Unable to find source java class while developing plugin for cordova (Android)

user3119509 :

I'm developing an plugin to cordova which uses an brazilian payment api called pagseguro. But that's not the point.

When I add my cordova plugin to my project and run "cordova run android", I receive this error and I don't know how to proceed:

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]'

Already tried to modify my plugin.xml. this is the plugin.xml right now:

<?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>

I'm using gradle to import dependecies, this is my build.gradle file:

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'
}

Someone knows what is causing this error? Thanks for the attention.

Arindam :

I am not using any special IDE (yes I live under a rock)

cordova clean

works for me

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=436907&siteId=1