No java files found that extend cordovaactivity
No java files found that extend cordovaactivity
No Java files found which extend CordovaActivity. when use «cordova build»
[Error: No Java files found which extend CordovaActivity.]
i searched the web but didn’t find the solution yet, What’s the problem?
14 Answers 14
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
I had the same error when I cloned my repository from another project. I solved it by removing the platforms and adding it again.
remove : cordova platform rm android
add : cordova platform add android
I had the same issue (albeit on Ubuntu) and tried Hyperizer’s answer, which should have worked. but to no effect for me. Note I had the error after upgrading cordova (from 3.0.9 to 3.4.0-0.1.3), and so my generated platforms folders were out of sync with the latest cordova version.
I found the cleanest thing to do (and this worked for me) is to remove your /platforms/android directory (as per cornelius’ answer. but my focus is cordova), and then recreate with cordova so you know everything is up to date and inline with the current cordova version.
Your android folder is recreated, and now try building and running again.
The downside of blowing away and recreating the android platform folder is that you will need to re-apply any customisations you may have made to the android source. (I hadn’t had to thankfully) but then you should be able to pull this from your git etc. At least now you are working on a clean and tidy up to date build.
Файлы Java не найдены, которые расширяют CordovaActivity. При использовании «кордовы строить»
[Error: No Java files found which extend CordovaActivity.]
Я искал в Интернете, но еще не нашел решение, в чем проблема?
У меня была такая же ошибка, когда я клонировал свой репозиторий из другого проекта. Я решил это, удалив платформы и добавив их снова.
Только по связанной теме, касающейся PhoneGap 3.2, вызывающей ту же ошибку, возможно, что вы, вероятно, испортили приложение при настройке и попытке запустить его изначально
Для меня работала, чтобы удалить созданные файлы платформы Android и снова запустить команду RUN. Поэтому из домашнего каталога проекта PhoneGap выполните следующие действия:
Я работаю над Macbook Pro с OSX версии 10.9
Надеюсь, это поможет кому-то!
Это изменилось в 3.2.0 – отправлено сообщение об ошибке: https://issues.apache.org/jira/browse/CB-5515
У меня была такая же проблема (хотя и на Ubuntu), и я попробовал ответ Гиперизера, который должен был сработать … но для меня это не повлияло. Заметьте, что у меня была ошибка после обновления кордовы (от 3.0.9 до 3.4.0-0.1.3), поэтому мои сгенерированные папки платформ не синхронизировались с последней версией кордовы.
Я нашел самую чистую вещь (и это сработало для меня) – удалить свою директорию / platform / android (согласно запросу cornelius … но мое внимание – это кордова), а затем воссоздать с кордорой, чтобы вы знали, что все в порядке На сегодняшний день и встроен с текущей версией кордовы.
Ваша папка android воссоздана, и теперь попробуйте создать и запустить снова.
Недостатком сдувания и воссоздания папки платформы Android является то, что вам нужно будет повторно применить любые настройки, которые вы, возможно, сделали для источника Android … (я не должен был благодарно), но тогда вы должны быть в состоянии вытащить Это от вашего git и т. Д. По крайней мере сейчас вы работаете над чистой и аккуратной современной сборкой.
Все, что вам нужно сделать, это удалить платформу платформы кордоры rm android и повторно добавить платформу, набрав платформу кордовы, добавьте android, и ошибка исчезнет
Я наткнулся на «решение» для тех, кто использует Framework, который «скрывает» расширение CordovaActivity, то есть MainActivity выглядит так:
Где GDCordovaActivy – это ваша Рамочная деятельность, расширяющая CordovaActivity.
Просто добавьте файл «foo.java» в проект, содержащий только комментарий:
Поскольку кордовая оболочка анализирует файл и не распознает комментарии, вы сможете позвонить в cordova android prepare и т. Д. Без каких-либо ошибок.
Это может произойти, если ваш id и android-packageName в android-packageName config.xml не совпадают.
У меня было слишком много настроек и я не хотел воссоздавать платформы.
I am migrating my project to Cordova 3 from Cordova 2.5. Followed the migration process mentioned in
But, unfortunately getting the following error
Preparing android project [Error: No Java files found which extend CordovaActivity.]
In our app, we have a class which extends activity and implements CordovaInterface. And moreover this class is in the location mentioned in config.xml.
Yet, I am facing the following error. Is it mandatory to substitute CordovaInterface with CordovaActivity? I am pretty sure that will not be the mandatory case.
2 Answers 2
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
This is causes by a bonehead, broken, Cordova build system.
If you simply add any old class in your source tree, next to your activity, that extends CordovaActivity, the build will work. You don’t even have to use the class, just make one.
It’s like they are having an internal debate about how it should work, and one side screwed over the other by making the build fail if they didn’t get their way.
With luck, someone on the dev team will notice this little conflict and fix it, I suppose it should be listed as a bug in their system, but I have not added it.
Не найдено ни одного Java-файла, расширяющего CordovaActivity. при использовании «кордова билд»
[Error: No Java files found which extend CordovaActivity.]
Я искал в Интернете, но пока не нашел решения. В чем проблема?
15 ответов
У меня была такая же ошибка, когда я клонировал свой репозиторий из другого проекта. Я решил это, удалив платформы и добавив их снова.
Все, что вам нужно сделать, это удалить платформу Cordova Platform RM Android и заново добавить платформу, набрав Cordova Platform Add Android, и ошибка исчезнет
В Eclipse или другом редакторе перейдите в исходный файл.java по адресу platform /android/src/ и убедитесь, что класс расширяет CordovaActivity (вместо этого он мог ранее расширить DroidGap).
У меня возникла та же проблема (хотя и в Ubuntu), и я попробовал ответ Hyperizer, который должен был сработать. но для меня это ни к чему не привело. Обратите внимание, что у меня была ошибка после обновления cordova (с 3.0.9 до 3.4.0-0.1.3), поэтому папки сгенерированных платформ были не синхронизированы с последней версией cordova.
Ваша папка Android восстановлена, и теперь попробуйте собрать и запустить снова.
Недостатком удаления и воссоздания папки платформы Android является то, что вам нужно будет повторно применить любые настройки, которые вы, возможно, сделали к источнику Android. (я не должен был к счастью), но тогда вы должны быть в состоянии вытащить это от вашего мерзавца и т. д. По крайней мере теперь вы работаете над чистой и аккуратной сборкой.
MainActivity.java file deleted on build when package name is changed in config.xml #1139
Comments
wedgberto commented Dec 2, 2020
Bug Report
Problem
MainActivity.java file is deleted when the package name changes
What is expected to happen?
When the package name is changed in config.xml, the MainActivity.java file is moved to the correct namespace path following the package name (E.g. io.cordova.hellocordova => io/cordova/hellocordova)
This allows an app to be built with different package names so it can be installed side by side on a device.
What does actually happen?
The MainActivity.java file that exists for the previous package name gets deleted and a new one in the path for the new package name is not created.
Information
changing the package name of the app in the config.xml between builds results in the android platform folder becoming broken because the MainActivity.java file gets deleted. It is only created when the platform is added.
I commented on the commit that broke this. Package name changes were supported in 8.1.0. see 3712619#r43030914
Command or Code
this results in the file platforms/android/app/src/java/io/cordova/hellocordova/MainActivity.Java being generated
cordova run android
cordova run android
hello cordova app builds but crashes when launched on device.
cordova run android
No Java files found that extend CordovaActivity.
Environment, Platform, Device
Windows 10 developer machine.
Android target platform.
Источники информации:
- http://www.ohandroid.com/java-31.html
- http://stackoverflow.com/questions/20354846/upgrading-from-cordova-2-5-to-cordova-3-0-facing-issue-while-using-cordovainte
- http://stackru.com/questions/31667419/ne-najdeno-ni-odnogo-java-fajla-rasshiryayuschego-cordovaactivity-pri-ispolzovanii-kordova-bild
- http://github.com/apache/cordova-android/issues/1139