fix(BuildHelper): get package name from ApplicationInfo (#1575)

This commit is contained in:
喻志强 2023-04-14 21:15:55 +08:00 committed by GitHub
parent 5b546a27e6
commit 7efe90faac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,7 +51,8 @@ public class BuildHelper {
{
try
{
Class<?> clazz = Class.forName(ctx.getClass().getPackage().getName() + ".BuildConfig");
String packageName = ctx.getApplicationInfo().packageName;
Class<?> clazz = Class.forName(packageName + ".BuildConfig");
Field field = clazz.getField(key);
return field.get(null);
} catch (ClassNotFoundException e) {