0

Worklight 6.1 Studio.

Created Android and iPhone Platform. While do "All Build" it fails and gives java.lang.NullPointerException.

Log:

[2014-03-13 21:08:27] Starting build process: application 'MobileApp', all environments<br>
[2014-03-13 21:08:33] Application build failed: java.lang.NullPointerException 
Blue Ice
  • 7,888
  • 6
  • 32
  • 52
Ragu
  • 402
  • 1
  • 4
  • 18
  • Google provide some solution by changing Workspace and importing the project agin not solves the issue. Getting the same. – Ragu Mar 14 '14 at 01:17

1 Answers1

1

Try the following:

  1. Delete the native folder
  2. Close Eclipse
  3. Locate your temp folder (Windows, OS X)
  4. Delete the wlBuildResources folder
  5. Open Eclipse
  6. Re-build

If you have native code in your native\ folder, you can do the following for Android (and similarly for iOS):

  1. copy android\native\res\xml\config.xml to android\nativeResources\res\xml folder (if the folder doesn't exist, create it)
  2. copy android\native\src\com\your-app-name\*.java files to android\nativeResources\src\com\your-app-name folder (if the folder doesn't exist, create it)
  3. copy android\native\AndroidManifest.xml to android\nativeResources folder

This way you do not need to fear removing the native folder; upon build time the files will be copied to their location in the native folder.

Community
  • 1
  • 1
Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • Hi Adar, Its not working. still getting the same issue. iPhone build no issue. but for android, it fails and gives null.pointer exception. – Ragu Mar 14 '14 at 14:19
  • Delete the native folder and follow the steps again. – Idan Adar Mar 14 '14 at 14:20
  • If i delete my native folder i will loose all my Custom Native Plugins, settings and java code added in my Android Native. – Ragu Mar 14 '14 at 14:33
  • You can backup and then delete it, and see if it resolves the issue. Then you can put the files back in place (AndroidManifest.xml, config.xml and java files you put in src\com\your-app\) – Idan Adar Mar 14 '14 at 14:35
  • See my edited answer for a way to not fear deleting the native folder. – Idan Adar Mar 14 '14 at 14:42
  • Thanks Adar. I will give a try and post my comment. – Ragu Mar 14 '14 at 14:55
  • Hi Adar, I tried it. As soon as i copied my existing AndroidManifest.xml to NativeResources folder and try to build it for android it gives the Null.Pointer Exception. I verified my manifest, it looks fine. No error. And one more point i noticed, The Native folder creates some ReadOnly file while build the environment. I think its the worklight.property file. If i build it again, it gives the Null.Pointer exception. Might be its not able to delete the readonly file and recreate the same while build again. Please let me know your view on this. Thanks – Ragu Mar 17 '14 at 14:52
  • You can delete it from the filesystem – Idan Adar Mar 17 '14 at 14:54
  • yap. I can do it in development. For QA & Production, I wrote the Ant Task which build the WL wlapp /adapter files and then build the native Android /iPhone .apk and .ipa files, Another Ant Task to deploy the WL build files to QA / Production server. I have a build server to run this task files on a button press. The Android build failed due to the same Null.Pointer exception in Ant Task. – Ragu Mar 17 '14 at 15:01
  • Hi Adar, I dig detail, I think its only because of the AndroidManifest.xml file. If i delete the complete native folder and delete my android manifest.xml file from nativeresources folder. It build the environment. But if i add my AndroidManifest.xml in NativeResource folder the build fails and gives Null.Pointer exception. It may be a defect in product. Should we raise PMR for this? – Ragu Mar 17 '14 at 15:16
  • It worked for me. I created a new project and app with Android environment, I copied native\AndroidManifest.xml to nativeResources\AndroidManifest.xml; change it a bit. Deleted the native folder and built the project. This created a new native folder with the AndroidManifest.xml from the nativeResources folder. – Idan Adar Mar 17 '14 at 15:16
  • Hi Adar. Yap, I tried the same. I think some issue with my AndroidManifest.xml If i copied the manifest file that has been created by WL Build process to NativeResource folder it works fine while re-build the environment. I will cross verify my Existing manifest with WL created one and digg more. Thanks Again. – Ragu Mar 17 '14 at 16:53
  • 1
    Hi Adar, Finally resolved the issue. It because Bad ManifestFile. Regenerated the same with my additional parameters solved the issue. Thanks for the great support. – Ragu Mar 17 '14 at 17:18