Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
This repository was archived by the owner on May 20, 2025. It is now read-only.

com.microsoft.codepush.react.CodePushMalformedDataException Unable to parse contents of [..]/codepush.json #1149

@maxkomarychev

Description

@maxkomarychev

Hi,

this is the crash report I've got from crash-analytics service. I wasn't able to reproduce it myself however whatever happens the codepush should not crash, it should safely fallback to original bundle if error happened during it's initialization.

Expected Behavior

CodePush should not crash the app. It should safely fallback to original bundle.

Actual Behavior

App crashes.

java.lang.RuntimeException An error occurred while executing doInBackground() 
    AsyncTask.java:318 android.os.AsyncTask$3.done
    FutureTask.java:354 java.util.concurrent.FutureTask.finishCompletion
    FutureTask.java:223 java.util.concurrent.FutureTask.setException
    FutureTask.java:242 java.util.concurrent.FutureTask.run
    ThreadPoolExecutor.java:1133 java.util.concurrent.ThreadPoolExecutor.runWorker
    ThreadPoolExecutor.java:607 java.util.concurrent.ThreadPoolExecutor$Worker.run
    Thread.java:761 java.lang.Thread.run


Caused by: com.microsoft.codepush.react.CodePushMalformedDataException Unable to parse contents of /data/user/0/my.package.name/files/CodePush/codepush.json, the file may be corrupted. 
    CodePushUtils.java:198 com.microsoft.codepush.react.CodePushUtils.getJsonObjectFromFile
    CodePushUpdateManager.java:55 com.microsoft.codepush.react.CodePushUpdateManager.getCurrentPackageInfo
    CodePushUpdateManager.java:105 com.microsoft.codepush.react.CodePushUpdateManager.getCurrentPackageHash
    CodePushUpdateManager.java:115 com.microsoft.codepush.react.CodePushUpdateManager.getCurrentPackage
    CodePushNativeModule.java:295 com.microsoft.codepush.react.CodePushNativeModule$4.doInBackground
    CodePushNativeModule.java:292 com.microsoft.codepush.react.CodePushNativeModule$4.doInBackground
    AsyncTask.java:304 android.os.AsyncTask$2.call
    FutureTask.java:237 java.util.concurrent.FutureTask.run
    ThreadPoolExecutor.java:1133 java.util.concurrent.ThreadPoolExecutor.runWorker
    ThreadPoolExecutor.java:607 java.util.concurrent.ThreadPoolExecutor$Worker.run
    Thread.java:761 java.lang.Thread.run


Caused by: org.json.JSONException End of input at character 0 of  
    JSONTokener.java:449 org.json.JSONTokener.syntaxError
    JSONTokener.java:97 org.json.JSONTokener.nextValue
    JSONObject.java:156 org.json.JSONObject.<init>
    JSONObject.java:173 org.json.JSONObject.<init>
    CodePushUtils.java:195 com.microsoft.codepush.react.CodePushUtils.getJsonObjectFromFile
    CodePushUpdateManager.java:55 com.microsoft.codepush.react.CodePushUpdateManager.getCurrentPackageInfo
    CodePushUpdateManager.java:105 com.microsoft.codepush.react.CodePushUpdateManager.getCurrentPackageHash
    CodePushUpdateManager.java:115 com.microsoft.codepush.react.CodePushUpdateManager.getCurrentPackage
    CodePushNativeModule.java:295 com.microsoft.codepush.react.CodePushNativeModule$4.doInBackground
    CodePushNativeModule.java:292 com.microsoft.codepush.react.CodePushNativeModule$4.doInBackground
    AsyncTask.java:304 android.os.AsyncTask$2.call
    FutureTask.java:237 java.util.concurrent.FutureTask.run
    ThreadPoolExecutor.java:1133 java.util.concurrent.ThreadPoolExecutor.runWorker
    ThreadPoolExecutor.java:607 java.util.concurrent.ThreadPoolExecutor$Worker.run
    Thread.java:761 java.lang.Thread.run

Reproducible Demo

  • If you can't reproduce the bug on it, provide us as much info as possible about your project

I do have this
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" line in build.gradle

Environment

  • react-native-code-push version: 5.2.1
  • react-native version: 0.50.3
  • iOS/Android/Windows version: android 7.0
  • Does this reproduce on a debug build or release build?
  • Does this reproduce on a simulator, or only on a physical device?
    Happened dozen of times on release build on physical device.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions