我正在开发一款适用于 Android 盒子的专有应用程序,它可以读取 HDMI 输入并将其显示在屏幕的一部分内。为此,我们使用 R9 Mini Android 电视盒 (link)。供应商提供了示例应用程序的源代码来读取 HDMI 输入,但该应用程序无法启动并抛出错误弹出窗口(不幸的是,SourceIn 已停止)。
以下是异常堆栈跟踪:
02-28 15:38:36.988 3232-3232/rtk.com.RealtekSourceIn W/art: Method processed more than once: void android.app.Instrumentation.callActivityOnResume(android.app.Activity)
02-28 15:38:37.090 3232-3232/rtk.com.RealtekSourceIn A/art: art/runtime/barrier.cc:90] Check failed: count_ == 0 (count_=-1, 0=0) Attempted to destroy barrier with non zero count
02-28 15:38:37.090 3232-3232/rtk.com.RealtekSourceIn A/art: art/runtime/runtime.cc:366] Runtime aborting --- recursively, so no thread-specific detail!
02-28 15:38:37.090 3232-3232/rtk.com.RealtekSourceIn A/art: art/runtime/runtime.cc:366]
02-28 15:38:37.090 3232-3232/rtk.com.RealtekSourceIn A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 3232 (RealtekSourceIn)
崩溃是从库依赖项内的代码发起的。关于调试反编译的.class 文件。以下是引发上述错误的代码:
static {
System.loadLibrary("realtek_runtime");
}
我在/system/lib/文件夹中看到了 .so 文件,并发现 librealtek_runtime.so
存在,因此我无法理解为什么 loadLibrary 失败。
相关代码如下:
RTKSourceInActivity:
public class RTKSourceInActivity extends Activity {
private String TAG="HDMIRxActivity";
private ViewGroup m_Root;
private HDMIRxPlayer m_HDMIRxPlayer = null;
private final Handler mHandler = new Handler();
private byte[] mCapture;
private static final long SCREENSHOT_SLOT = 200;
private boolean mIsFullScreen = true;
private File mRecordFile;
private boolean mRecordOn = false;
@Override
public void onResume() {
Log.d(TAG,"onResume");
super.onResume();
if(hasRtkMusicPlaybackService()) {
Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "stop");
sendBroadcast(i);
}
m_Root = (ViewGroup) findViewById(R.id.root);
m_HDMIRxPlayer = new HDMIRxPlayer(this, m_Root, 1920, 1080);
}
...
}
HDMIRx播放器:
public HDMIRxPlayer(Context context, ViewGroup parent, int width, int height)
{
mContext = context;
mSurfaceView = new SurfaceView(context);
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.addCallback(HDMIRXCallback);
mSurfaceHolder.setFixedSize(width, height);
parent.addView(mSurfaceView);
mHDMIRX = new RtkHDMIRxManager(); // Exception here
IntentFilter hdmiRxFilter = new IntentFilter(HDMIRxStatus.ACTION_HDMIRX_PLUGGED);
mContext.registerReceiver(hdmiRxHotPlugReceiver, hdmiRxFilter);
}
RtkHDMIRxManager
是供应商提供的依赖项 jar (realtek-classes) 中的 .class。
当我在 RtkHDMIRxManager
的反编译版本中放置调试点时,我在以下位置发现了异常:
static {
System.loadLibrary("realtek_runtime");
}
任何指向解决方案的方向都会有很大帮助。
最佳答案
2种解决方法:
我必须使用
android:sharedUserId="android.uid.system"
并使用相应的pem
和pk8
文件对应用程序进行签名。安装应用程序,使用adb命令将应用程序移动到/system/目录中。不是,它是一个系统应用程序。您现在可以共享所有系统资源。
关于java - Android:无法加载系统库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42506579/