Tencent/tinker · error · TinkerRuntimeException
libName or appLike is null!
Error message
libName or appLike is null!
What it means
TinkerLoadLibrary.loadArmLibraryWithoutTinkerInstalled(ApplicationLike, String) validates its arguments and throws TinkerRuntimeException("libName or appLike is null!") when libName is null/empty or the ApplicationLike wrapper is null. The '*WithoutTinkerInstalled' variants are meant for loading native libraries through Tinker's ABI-selection logic even when Tinker patching itself is not installed, so the only precondition checked is argument sanity.
Source
Thrown at tinker-android/tinker-android-lib-no-op/src/main/java/com/tencent/tinker/lib/library/TinkerLoadLibrary.java:39
import com.tencent.tinker.entry.ApplicationLike;
import com.tencent.tinker.loader.TinkerRuntimeException;
/**
* Created by zhangshaowen on 17/1/5.
* Thanks for Android Fragmentation
*/
public class TinkerLoadLibrary {
public static void loadArmLibrary(Context context, String libName) {
if (libName == null || libName.isEmpty() || context == null) {
throw new TinkerRuntimeException("libName or context is null!");
}
System.loadLibrary(libName);
}
public static void loadArmLibraryWithoutTinkerInstalled(ApplicationLike appLike, String libName) {
if (libName == null || libName.isEmpty() || appLike == null) {
throw new TinkerRuntimeException("libName or appLike is null!");
}
System.loadLibrary(libName);
}
public static void loadArmV7Library(Context context, String libName) {
if (libName == null || libName.isEmpty() || context == null) {
throw new TinkerRuntimeException("libName or context is null!");
}
System.loadLibrary(libName);
}
public static void loadArmV7LibraryWithoutTinkerInstalled(ApplicationLike appLike, String libName) {
if (libName == null || libName.isEmpty() || appLike == null) {
throw new TinkerRuntimeException("libName or appLike is null!");
}
System.loadLibrary(libName);
}
View on GitHub (pinned to 1b7ea02c23)
Solutions
- Create/obtain the ApplicationLike first (typically app = ApplicationLike(this) inside your Application) and pass it to the call.
- Verify the libName constant is non-empty in every build variant (Log it).
- Move the call to a lifecycle point where both arguments are guaranteed initialized, e.g. Application.onCreate.
Example fix
// before
TinkerLoadLibrary.loadArmLibraryWithoutTinkerInstalled(appLike, "native-lib"); // appLike still null
// after
@Override
public void onCreate() {
super.onCreate();
appLike = new ApplicationLike(this);
TinkerLoadLibrary.loadArmLibraryWithoutTinkerInstalled(appLike, "native-lib");
} Defensive patterns
Strategy: validation
Validate before calling
if (appLike != null && libName != null && !libName.trim().isEmpty()) {
TinkerLoadLibrary.loadArmLibraryWithoutTinkerInstalled(appLike, libName);
} Prevention
- Construct ApplicationLike in attachBaseContext before any load call
- Keep native loads in Application.onCreate where dependencies are initialized
When it happens
Trigger: Calling loadArmLibraryWithoutTinkerInstalled(appLike, libName) with a null ApplicationLike (application not wrapped / passed too early) or a null/empty libName.
Common situations: Migrating an app to Tinker where ApplicationLike is created in attachBaseContext but the library load runs from a static initializer or another class that captures it too early; referencing a library name constant that only exists in one product flavor.
Related errors
- libName or context is null!
- you must install tinker before get tinker sInstance
- Context must not be null.
- tinkerLoadVerifyFlag must not be null.
- loadReporter must not be null.
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/ef542c0a0efec30d.
Report an issue: GitHub.