Tencent/tinker · error · TinkerRuntimeException
libName or context is null!
Error message
libName or context is null!
What it means
TinkerLoadLibrary.loadArmLibrary(Context, String) (no-op variant shipped in tinker-android-lib-no-op) validates its arguments before calling System.loadLibrary, throwing TinkerRuntimeException("libName or context is null!") when libName is null, empty, or context is null. The no-op artifact exists so release-only Tinker code can compile in builds where Tinker is disabled; the guards still fire because they are argument checks, not patch logic.
Source
Thrown at tinker-android/tinker-android-lib-no-op/src/main/java/com/tencent/tinker/lib/library/TinkerLoadLibrary.java:32
* limitations under the License.
*/
package com.tencent.tinker.lib.library;
import android.content.Context;
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);
}
View on GitHub (pinned to 1b7ea02c23)
Solutions
- Pass the application context (e.g. from ApplicationLike.getApplication() or onAttachBaseContext) and a hard-coded, verified library name.
- Check the source of the libName string — log it before the call to catch empty/whitespace values.
- If the call is only meaningful with Tinker enabled, gate it behind Tinker.isTinkerInstalled() or your own build-variant flag.
Example fix
// before
TinkerLoadLibrary.loadArmLibrary(context, libName); // context null in this variant
// after
if (context != null && libName != null && !libName.trim().isEmpty()) {
TinkerLoadLibrary.loadArmLibrary(context, libName);
} else {
Log.w(TAG, "skip loadArmLibrary: context=" + context + " libName='" + libName + "'");
} Defensive patterns
Strategy: validation
Validate before calling
if (context != null && libName != null && !libName.trim().isEmpty()) {
TinkerLoadLibrary.loadArmLibrary(context, libName);
} else {
Log.w(TAG, "loadArmLibrary skipped: bad args");
} Prevention
- Pass the application context from a lifecycle callback, never an early-captured field
- Define library names as final constants per flavor
When it happens
Trigger: Calling loadArmLibrary(context, libName) with a null Context (e.g. before it is initialized) or with a null/empty library name string (typo'd constant, config key missing).
Common situations: Using the no-op dependency in a debug build variant while production code calls loadArmLibrary; loading a .so whose name comes from BuildConfig or a config map that is unset in that variant; calling from a component where the context field is not yet assigned.
Related errors
- libName or appLike 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/041cb0edaf90f006.
Report an issue: GitHub.