Actual Behaviour
App generated using api endpoint is crashing on starting because of required file(event) is not available in assets folder. But we are using event file in OpenEventApp.java
Expected Behaviour
There should be required files in assets folder so that app don't crash. And also if in first time running app user click "No" for downloading latest data, app should show data from assets.
We should download event data while generating app and store it in assets folder.
Steps to reproduce it
Generate app using api endpoin, install and run app
LogCat for the issue
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)
at org.json.JSONTokener.nextValue(JSONTokener.java:94)
at org.json.JSONObject.<init>(JSONObject.java:156)
at org.json.JSONObject.<init>(JSONObject.java:173)
at org.fossasia.openevent.OpenEventApp.onCreate(OpenEventApp.java:164)
Would you like to work on the issue?
Yes
Target Milestone to solve the issue
actually the api endpoint is provided in the assets folder in config.json i think.
what issue are you facing?
It's funny, I was going to create the same issue just now. I forgot it had been created already.
@niranjan94 In generator.py, the temporary assets are copied to app's assets and the temporary assets comprise of
The last two are also copied to the assets, completely raw, so that's an issue of its own
Secondly, app is relying on event file to get some description, which is not included in assets. In fact, the app assumes that all json files of event, speaker, etc are present in the assets folder, which is not the case here, and that is why it crashes
:smile: @iamareebjamal almost fixed this issue.
sending PR soon..
@iamareebjamal True background_image.png, ic_launcher.png are copied in assets. And in fossasia sample size of background image is 1.8Mb which is increasing apk size.
We can remove it it after resizing in resize_background_image.
No need to remove, just don't copy it in assets
Actually there is for loop to copy files from temp-assets to assets. so if will be better if remove it. because for not copying it will require condition check.
also in generator.py are only the background.png and logo.png being copied?
because the speaker image dont seem to get copied. and @Shailesh351 the one you wrote in the scrum that speaker image issue is resolved, its not yet resolved!
In generator.py three files are being copied from temp-assets to app/sec/main/assets
Speaker images are in zip files and this issue is for API end point
Including the speaker images in app will greatly increase its size
And the issue with image links doesn't exist in the API endpoint generation
Most helpful comment
Actually there is for loop to copy files from temp-assets to assets. so if will be better if remove it. because for not copying it will require condition check.