Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meteor build android: "No Java files found which extend CordovaActivity." #7375

Closed
pkumar-uk opened this issue Jul 9, 2016 · 6 comments
Closed

Comments

@pkumar-uk
Copy link

#7145 Meteor build android: "No Java files found which extend CordovaActivity."

This was was closed as there was a work around. It is not critical issue but would be nice to have a fix. I wanted to reopen this as it is still occurring. I hope I have some pointer for recreating the issue.

Android build fails sometimes while building on both Mac or Linux. The problem has surfaced after moving to 1.3. I have now moved to Meteor 1.3.4.1 but it has not gone.

I have observed the following:-

  • I develop code on Mac but final deployment happens for Linux. With Meteor 1.3 during the build process on Mac I use the architecture flag. After finishing the run on Mac when Meteor build is initiated the app building process invariably fails. The only workaround seems to be to delete .meteor/local/cordova-build and rerun the build process.
  • I use the same codebase to generate more than one mobile app, each time I initiate the build (using APP_FOR variable to specify particular set) without clearing the cordova-build directory the build process again fails. This happens with linux as well.

This is irritating as build process takes time. This error has started with moving to Meteor 1.3 ( even moving to Meteor 1.3.4.1 did not remove this error).

my error dump is shown below.


=> Errors executing Cordova commands:                                              

   While adding plugin cordova-plugin-geolocation@2.1.0 to Cordova project:        
   No Java files found which extend CordovaActivity.                               
   at updateProjectAccordingTo (/home/kumar/pgm/meteor/msgs8/.meteor/local/cordova-build/platforms/android/cordova/lib/prepare.js:151:15)
   at /home/kumar/pgm/meteor/msgs8/.meteor/local/cordova-build/platforms/android/cordova/lib/prepare.js:41:16
   at _fulfilled (/home/kumar/pgm/meteor/msgs8/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:834:54)
   at self.promiseDispatch.done
   (/home/kumar/pgm/meteor/msgs8/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:863:30)
   at Promise.promise.promiseDispatch
   (/home/kumar/pgm/meteor/msgs8/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:796:13)
   at /home/kumar/pgm/meteor/msgs8/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:556:49
   at runSingle (/home/kumar/pgm/meteor/msgs8/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:137:13)
   at flush (/home/kumar/pgm/meteor/msgs8/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:125:13)
   at process._tickCallback (node.js:458:13)

/home/kumar/.meteor/packages/meteor-tool/.1.3.4_1.1x5b5og++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/isopackets/cordova-support/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:165
      throw error;
            ^
ExitWithCode:1

I do not have a solution just a work around. Any fix or suggestion would be great.

@abernix
Copy link
Contributor

abernix commented Jul 12, 2016

I will leave this open for the time-being. It seems to be a common bug outside of Meteor though, so I'm not sure if it's directly Meteor related or if it's Cordova related.

Any input from those more familiar with the issue would be greatly appreciated.

@wojtkowiak
Copy link
Contributor

@abernix my package omega:meteor-desktop-bundler caused something similar meteor-desktop#33:

While preparing Cordova project for platform Android:
 No Java files found that extend CordovaActivity.

I have spent around 20h o track this down and it seems that my first assumptions that this is related to two different version of shelljs being used in my case was true.
The scenario here is different because I am using shelljs in a build plugin but in other cases it still might be related.
Just sharing my knowledge in case this would help others track down problems like that. Here is an explanation of how this happened in my case:

https://github.com/wojtkowiak/meteor-desktop/blob/v0.2.3/plugins/bundler/bundler.js#L299

Unfortunately in my case I ended with a workaround, because I could not afford two other options which would be: not use shelljs at all or use the same version as cordova is using.

@hwillson
Copy link
Contributor

hwillson commented Nov 2, 2017

There have been many new Meteor releases (including cordova and other related mobile dependency updates) since this issue was created. Please try things out with Meteor 1.6 and post back if this issue is still happening. Thanks!

@hwillson hwillson closed this as completed Nov 2, 2017
@pkumar-uk
Copy link
Author

This issue has not disappeared ...I still get the issue and only way to remove it is by clearing cordova-build. it always fails with

%% Resolving module name for cordova-common => cordova-common                      
%% Failed to install 'cordova-plugin-meteor-webapp': Error: ENOENT: no such file or directory, open '/Users/perumalkumar/pgm/meteor/stppeifyv1/.meteor/local/cordova-build/platforms/ios/APMS/Bridging-Header.h'
    at Object.fs.openSync (fs.js:648:18)
    at Object.fs.readFileSync (fs.js:553:33)
    at module.exports (/Users/perumalkumar/pgm/meteor/stppeifyv1/.meteor/local/cordova-build/plugins/cordova-plugin-meteor-webapp/scripts/iosAddBridgingHeader.js:21:17)
    at runScriptViaModuleLoader (/Users/perumalkumar/.meteor/packages/meteor-tool/.1.6.0.1i4ja4w++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/hooks/HooksRunner.js:189:18)
    at runScript (/Users/perumalkumar/.meteor/packages/meteor-tool/.1.6.0.1i4ja4w++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/hooks/HooksRunner.js:165:16)
    at /Users/perumalkumar/.meteor/packages/meteor-tool/.1.6.0.1i4ja4w++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/hooks/HooksRunner.js:133:20
    at _fulfilled (/Users/perumalkumar/.meteor/packages/meteor-tool/.1.6.0.1i4ja4w++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/Users/perumalkumar/.meteor/packages/meteor-tool/.1.6.0.1i4ja4w++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/Users/perumalkumar/.meteor/packages/meteor-tool/.1.6.0.1i4ja4w++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/q/q.js:749:13)
    at /Users/perumalkumar/.meteor/packages/meteor-tool/.1.6.0.1i4ja4w++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/q/q.js:810:14
    at flush (/Users/perumalkumar/.meteor/packages/meteor-tool/.1.6.0.1i4ja4w++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/q/q.js:108:17)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
=> Errors executing Cordova commands:                                              
                                                                                   
   While adding plugin cordova-plugin-meteor-webapp@1.4.2 to Cordova project:      
   Error: ENOENT: no such file or directory, open '/Users/perumalkumar/pgm/meteor/stppeifyv1/.meteor/local/cordova-build/platforms/ios/APMS/Bridging-Header.h'
   at Object.fs.openSync (fs.js:648:18)
   at Object.fs.readFileSync (fs.js:553:33)
   at module.exports (/Users/perumalkumar/pgm/meteor/stppeifyv1/.meteor/local/cordova-build/plugins/cordova-plugin-meteor-webapp/scripts/iosAddBridgingHeader.js:21:17)
   at runScriptViaModuleLoader
   (/Users/perumalkumar/.meteor/packages/meteor-tool/.1.6.0.1i4ja4w++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/hooks/HooksRunner.js:189:18)

@ramrami
Copy link

ramrami commented Jul 5, 2018

I'm having the same issue with METEOR@1.6.1.3. Deleting .meteor/local/cordova-build does not work for me.

When I check the file :
.meteor/local/cordova-build/platforms/android/src/com/id1d10m9yd7fq1hsv663c/MainActivity.java
It contains only one line up to date in 0.663s , which is weird.

After inspecting the logs, one line seems weird to me, and may point to the cause :
%% Wrote out Android package name "com.id1d10m9yd7fq1hsv663c" to <project>/.meteor/local/cordova-build/platforms/android/src/com/id1d10m9yd7fq1hsv663c/MainActivity.java

Note: When the build starts, the file .meteor/local/cordova-build/platforms/android/src/com/id1d10m9yd7fq1hsv663c/MainActivity.java does exist , and contains java code, but during the build it gets replaced by one line up to date in 0.663s

@ramrami
Copy link

ramrami commented Jul 5, 2018

I tracked down to .meteor/local/cordova-build/platforms/android/cordova/lib/prepare.js

I put a return before these lines :

    return;

    var destFile = path.join(locations.root, 'src', androidPkgName.replace(/\./g, '/'), path.basename(java_files[0]));
    shell.mkdir('-p', path.dirname(destFile));
    shell.sed(/package [\w\.]*;/, 'package ' + androidPkgName + ';', java_files[0]).to(destFile);
    events.emit('verbose', 'Wrote out Android package name "' + androidPkgName + '" to ' + destFile);

And the build passed ...

Edit :
It's this line :

shell.sed(/package [\w\.]*;/, 'package ' + androidPkgName + ';', java_files[0]).to(destFile);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants