fix: add proguard rules for ausbc to fix JNI NoSuchFieldError
This commit is contained in:
1 parent
ee2769b487
commit
6b2d38ffe5
11 files changed
+87
-43
No files matched your search
@@ -0,0 +1,30 @@
|
||||
const { withDangerousMod } = require('@expo/config-plugins');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const withProguardRules = (config) => {
|
||||
return withDangerousMod(config, [
|
||||
'android',
|
||||
async (config) => {
|
||||
const proguardPath = path.join(config.modRequest.platformProjectRoot, 'app', 'proguard-rules.pro');
|
||||
const customRules = `
|
||||
# Keep ausbc and UVCCamera classes for JNI
|
||||
-keep class com.serenegiant.usb.** { *; }
|
||||
-keepclassmembers class com.serenegiant.usb.** { *; }
|
||||
-keep class com.jiangdg.ausbc.** { *; }
|
||||
-keepclassmembers class com.jiangdg.ausbc.** { *; }
|
||||
`;
|
||||
if (fs.existsSync(proguardPath)) {
|
||||
let content = fs.readFileSync(proguardPath, 'utf8');
|
||||
if (!content.includes('com.serenegiant.usb')) {
|
||||
fs.appendFileSync(proguardPath, customRules);
|
||||
}
|
||||
} else {
|
||||
fs.writeFileSync(proguardPath, customRules);
|
||||
}
|
||||
return config;
|
||||
},
|
||||
]);
|
||||
};
|
||||
|
||||
module.exports = withProguardRules;
|
||||
Reference in new issue
Block a user