-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Android: com.microsoft.codepush.react.CodePushUnknownException: Error in getting binary resources modified time #1961
Comments
I added the following to my android/app/build.gradle and it work as a workaround. I'm guessing this is likely an android gradle plugin issue. There seem to be a bunch of undocumented breaking changes in AGP 4.1+ that affect React Native. under
|
Sorry but I likely won't have time to make a reproduction anytime soon. I think this is probably reproducible by upgrading any react native project with codepush to android gradle plugin 4.1+. |
Hi @AndrewMorsillo could you please double-check that the following step is performed in your app:
? |
@ruslan-bikkinin Yes, I have the gradle plugin applied correctly. I had been using code push without issue for many months in my app. This suddenly broke when I updated to Android gradle plugin 4.1+. I did not change anything related to my code push configuration. I suspect you can reproduce this issue by upgrading any react native app to android gradle plugin 4.1+. I found the workaround in this old issue: #771 |
@AndrewMorsillo got it. Thanks for the info, we'll check it out. |
Hi @AndrewMorsillo unfortunately, I couldn’t reproduce your issue on my side.
buildscript {
ext {
// ...
dependencies {
classpath(‘com.android.tools.build:gradle:4.1.0’)
}
}
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
Did you do any extra steps aside mine to migrate to Android Gradle plugin 4.1.0? Also, you can try to reinstall and reconfigure |
I have the same issue after updating to Reverted to |
It work for me by reverting the gradle version. |
I confirm that the downgrade solved the issue. @ruslan-bikkinin - in order for this to reproduce, I believe, you need to follow these steps:
What happened in our case is that we had version 1.1.6 live on the store (with the old gradle version plugin), which also had a codepush. Then we released a new version (1.1.7), which included an update of the gradle plugin. After the update, the app crashed immediately on pressing the app icon. We submitted a new 1.1.7 build, with the old gradle version, and this fixed the issue. |
Hi @andiradulescu , It depends on target binary version of your update. If you have as |
Hi, we are planning to release a new version of our app and upgraded all the dependencies. We decided to test the codepush before the release and getting the same error: Our version of the app: 2.0.0 and the target version is 2.0.0. |
I can confirm that this works:
e.g.
|
@ruslan-bikkinin can you again in rn 0.64 with hermes enable, code-push 6.4.1( my version), still reproduce this issue, and |
In my case,"org.gradle.configureondemand=true" in file "gradle.property" will produce this error, remove this line will be ok.(last rn0.61 dont lead to this error, after upgrade to rn0.64 the error come out) |
I can confirm that we had a crashing build, following an upgrade to the android gradle plugin to 4.1; and applying the fix above ( |
(resValue 'string', "CODE_PUSH_APK_BUILD_TIME...) fixed it for me |
The same when i use react-native-config I can confirm that that works. defaultConfig { but this is the best solution, right? |
I was experiencing this issue as well. I noticed that in the codepush.gradle file the value for CODE_PUSH_APK_BUILD_TIME is applied using buildTypes.each. However, in my app level build.gradle I have:
notice that release is commented out. So, the apk build time value was only being applied to the debug buildType (via buildTypes.each). This would explain why adding it to defaultConfig seems to fix this issue. Is anyone else here able to confirm that this error occurs when there is no release buildType configured? |
You're a light in darkness! |
Thank you, this worked for me too 🙌 However, I already had one |
I am also getting the same error. Maybe it's a compatibility issue with react native config.
|
I'm having issues too. Adding |
This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment. |
This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion. |
thats worked for me too |
The issue is still present in version 7.0.4 apart from above workaround does anyone have permanent fix |
both solutions seem to work for me (either gradle downgrade or patch) |
#1961 (comment) also worked for me.
|
I tried all the solutions above and nothing works at all. |
same here |
Same issue using |
In my case I fixed this error by adding these lines: afterEvaluate {
android.buildTypes.each {
it.resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis())
}
} to the bottom of my
It's copied directly from react-native-code-push/android/codepush.gradle Lines 20 to 25 in a9da067
Environment:
I think the problem lies with
However it didn't make it to final
You can check yourself if the CODE_PUSH_APK_BUILD_TIME managed to be included as android resource, by checking A successful inclusion will look like this <?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Automatically generated file. DO NOT MODIFY -->
<!-- Value from build type: debug -->
<string name="CODE_PUSH_APK_BUILD_TIME" translatable="false">"1662439557897"</string>
<!-- Value from build type: debug -->
<integer name="react_native_dev_server_port">8081</integer>
<!-- Value from build type: debug -->
<integer name="react_native_inspector_proxy_port">8081</integer>
</resources> If |
Following for a proper fix. using #1961 (comment) for now. |
This is worked for me. 🚀 Old app: RN 0.66.1 I use CodePush CLI and it's at v3.0.0. |
Hi ! The same error happened to me while trying to experiment with React-Native and CodePush for the first time. npx react-native init AwesomeTSProject --template react-native-template-typescript Then the app is built on debug mode and deployed manually on a real Android 10 device with the following steps: mkdir -p android/app/src/main/assets/
touch android/app/src/main/assets/index.android.bundle
# Bundle the app
npx react-native bundle \
--platform android \
--dev false \
--entry-file index.js \
--bundle-output android/app/src/main/assets/index.android.bundle \
--assets-dest android/app/src/main/res/
# Build a debug APK
cd android && gradlew assembleDebug
# Deploy on a real device
adb install android/app/build/outputs/apk/debug/app-debug.apk When running the app, the CodePush update is detected on the server and downloaded but not installed because the sync fail with the following error:
On the positive side, @evelant fix is working Environment:
I hope this old bug gets more attention :) |
Solved, thanks! |
@evelant you save my life |
Apparently this only affects buildType "releaseStaging", in "release" everything runs fine. That's it? |
Unfortunately was same problem "CodePushUnknownException; Error in getting binary resources modified time" RN 0.67.5 Adding at defaultConfig this line an upgrade RN Code Push to 7.1.0 solved my problem
|
With latest version 7.1.0 I still had to add this to get it working in releaseStaging... |
I can confirm this issue is still there on version 7.4.2. But above solution works well. |
Hello @sheikhazazkhalid , could you please clarify which version of the Android Gradle Plugin (AGP) you are using? If you are currently on version 4.1, have you considered upgrading to a newer version to see if that resolves your issue? |
Steps to Reproduce
Expected Behavior
Codepush was working until recently. Seems it was likely the update to RN 0.63.3 or Android Gradle plugin 4.1+.
Actual Behavior
What actually happens?
Reproducible Demo
Will update with repro when available
Environment
The text was updated successfully, but these errors were encountered: