Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Fix crash when minifyEnabled=true #269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

COO1M
Copy link

@COO1M COO1M commented Oct 5, 2022

Fix: #266 #165
In Android APP projects, minifyEnabled is usually set to true in the release version to enable Proguard. But when minifyEnabled=true, LiteModuleLoader.load() will crash, I guess it should be caused by Proguard's obfuscation.
It can be reproduced in the HellowWorld demo, you can try it in other demos, the following is my environment configuration:

Gradle Plugin Version: 7.3.0
Gradle Version: 7.5.1
JDK: 11

compileSdkVersion: 33
buildToolsVersion: 33.0.0
ndkVersion: 25.1.8937393
minSdkVersion: 21
targetSdkVersion: 33

org.pytorch:pytorch_android_lite: 1.12.2
org.pytorch:pytorch_android_torchvision_lite: 1.12.2

So I tried to find the official proguard rules from the demo, but I couldn't find them, so I added rules for org.pytorch.*, com.facebook.* to avoid them being obfuscated. It works both in my APP and in the HellowWorld demo.
Of course, it would be better if you could give more accurate Proguard rules, looking forward to your reply.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flutter App crashed in release version only
2 participants