No Java files found that extend CordovaActivity

7.8k views Asked by At

I'm attempting to build a cordova app to release to android devices but receiving the following error message:

"Error: No Java files found that extend CordovaActivity"

It appears that the source of the error is that build folder that is to contain the source files is not being built. That is, the files that are to be created in the folder "src" isn't generated during the build and so the following warning is returned during each build:

ls: no such file or directory: ...\platforms\android\src\io\cordova\myappedc27c*.java

That is, the directory path "..\io\cordova\myappedc27c" is not being created.

Currently running Visual Studio 2017 version 15.7 on Windows 7 Pro.

Any help is appreciated.

4

There are 4 answers

0
Russ On

I am developing an Ionic (5) app and saw this randomly pop up as well. Removing just the android platform under platforms wasn't good enough. I removed the entire platforms directory and while I was at it, also removed out-tsc, plugins and www.

0
Véger Lóránd On

ionic cordova platform rm android then ionic cordova platform add android@latest command solved the problem for my Ionic 3 application.

0
Porter Lyman On

This happened to me after renaming the default Cordova config and package names. I fixed it by doing the following:

cordova platform remove android

cordova platform add android

Substitute android for each platform you'll be using.

0
rashidnk On

This happens most of the time when you change the <widget id="com.xxx.appname" in the config.xml

to make sure the package name in the android project is correct as per the config.xml

suppose your app package name in config.xml is as com.mycompany.appname

Step 1

Open platforms/android/app/src/main/java folder and find the MainActivity.java

MainActivity.java should be inside folder com/mycompany/appname

So the full path need to be like platforms/android/app/src/main/com/mycompany/appname/MainActivity.java

Step 2

Open Mainactivity.java the first line should be same package name as below.

package com.mycompany.appname

once you corrected the issue, you can try again.

cordova prepare 
cordova build android