1

While trying to tackle the native map not showing problem, I was experimenting with building Android app with certificates. I used a simplify test where the source contains only:

    Form hi = new Form("Welcome", new BorderLayout());
    MapContainer c = new MapContainer();
    hi.add(BorderLayout.CENTER, c);
    hi.show();

, and relevant build hints:

codename1.android.keystore=...
codename1.android.keystoreAlias=...
codename1.android.keystorePassword=...
codename1.arg.android.debug=false
codename1.arg.android.GoogleMaps.minPlayServicesVersion=9.4.0
codename1.arg.android.playService.maps=true
codename1.arg.android.release=true
codename1.arg.android.xapplication=<meta-data android\:name\="com.google.android.maps.v2.API_KEY" android\:value\="AIza......."/>
codename1.arg.android.playService.maps=true

I used certificate generated through the CN1 generator. Before adding the certificate, the build went fine without any complaints, but after adding the certificate, build failed with a similar error log as in another question with parse CN1Lib. This is the complete error log.

I'd like to know if this can be resolved or do I need some workaround for it? Thanks in advance.

Edit: I'm not sure if this help, but the issue can be reproduced through:

  1. Create a new cn1 project (I used Eclipse Oxygen), then install native Google maps plugin and refresh cn1lib as instructed

  2. In the start(), add a new MapContainer to the form with BorderLayout in Center

  3. Add the build hints as instructed in github for the native maps cn1lib

  4. Add Android certificate in cn1 settings

  5. Build the project

Things that are not mentioned are left in default state

R. Wang
  • 353
  • 4
  • 11
  • Are you using the latest native maps cn1lib? It doesn't look like its related to the certificate. The error message is a generic one you need to look at the warnings above to see the actual issue in this case it's: `Warning: com.codename1.googlemaps.MapContainer$2$1: can't find enclosing method 'void actionPerformed(com.codename1.ui.events.ActionEvent)' in program class com.codename1.googlemaps.MapContainer$2` which means something failed with the native maps install/integration somehow? – Shai Almog Jan 25 '18 at 05:20
  • The cn1lib was downloaded through the cn1 settings. I'll try to build from the source code to see if the problem persists – R. Wang Jan 27 '18 at 03:50
  • Check for update there, if you go to Codename One settings and there is a new version it will let you download an update. – Shai Almog Jan 27 '18 at 05:25
  • I tried to check update through the cn1 settings / by downloading from github directly. However, neither changed the 'can't find enclosing method' Warning. When I removed the Android certificate, the build goes through without any problems. I guess this would be a bug then? – R. Wang Jan 27 '18 at 13:42
  • The build would go through without a certificate because obfuscation doesn't run (it becomes a debug build instead of a release build) so you would have unresolved entries that fail in runtime instead of compile time. Are you using versioned build or some other feature? – Shai Almog Jan 28 '18 at 05:18
  • The 'Versioned Build' was set to latest, 'Include Source' unclicked, Android 'Generate Build' set to 'Release'. Most settings except the build hints are kept at default value. Basically I didn't change anything except the build hints required, adding the cn1lib and the android certificate – R. Wang Jan 29 '18 at 11:06
  • Sorry about all of that, it seems we pushed out a bad update! I was sure it was OK because I was confident I was using the latest version... I'm fixing it and will update soon. – Shai Almog Jan 30 '18 at 05:09

1 Answers1

1

Sorry about that issue, we pushed out a bad update as part of refactoring work. I've pushed out a fix just now and it should be available for update.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • I've tried again with the test app. This time all warnings are gone, but the build still won't go through, with specific error: ../MyApplication/src/main/java/com/codename1/googlemaps/InternalNativeMapsImpl.java:468: error: cannot find symbol mapInstance.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener() { ^ symbol: class OnCameraMoveListener location: class GoogleMap Note: Some input files use or override a deprecated API. – R. Wang Feb 02 '18 at 18:39
  • Strangely enough, though, using the v22 of cn1lib allows the build to go through... The new cn1lib may have something to do with the problem I suspect – R. Wang Feb 02 '18 at 18:47
  • Do you point at an older version of google play services? Are you sure those are the only android.* properties in your codenameone_settings? – Shai Almog Feb 03 '18 at 05:42
  • Below is the settings file fyi # #Sun Feb 04 23:12:43 CST 2018 codename1.vendor=CodenameOne codename1.displayName=MapTest2 codename1.icon=icon.png codename1.arg.java.version=8 codename1.languageLevel=5 codename1.secondaryTitle=MapTest2 codename1.version=1.0 codename1.mainName=MyApplication codename1.ios.certificatePassword= codename1.arg.ios.newStorageLocation=true codename1.rim.signtoolDb= codename1.arg.ios.pods.platform=,7.0 libVersion=205 codename1.ios.certificate= codename1.arg.ios.objC=true ... – R. Wang Feb 04 '18 at 15:48
  • codename1.android.keystorePassword=... codename1.j2me.nativeTheme=nativej2me.res codename1.rim.signtoolCsk= codename1.arg.ios.pods.sources=,https\://github.com/CocoaPods/Specs.git – R. Wang Feb 04 '18 at 15:50
  • codename1.arg.android.xapplication= codename1.arg.ios.pods=,GoogleMaps codename1.arg.android.xpermissions= codename1.arg.ios.glAppDelegateHeader=\n\#import "GoogleMaps/GoogleMaps.h" codename1.android.keystore=. – R. Wang Feb 04 '18 at 15:51
  • codename1.android.keystoreAlias=Alias codename1.rim.certificatePassword= codename1.ios.provision= codename1.arg.android.playService.maps=true codename1.packageName=com.mycompany.myapp – R. Wang Feb 04 '18 at 15:51
  • Can you send the full error log link? You can use the chat widget in the website to send us the URL to the full log – Shai Almog Feb 05 '18 at 05:01
  • I removed the old test project and created a new one. Now the project goes through the build process without any problems. Maybe the lib wasn't updated after the lib was published, or it was caused by me not clicking 'Refresh Libs' after 'Update Project Libs'. Anyway I think it can be marked as solved. Thanks – R. Wang Feb 05 '18 at 15:28