【发布时间】:2018-12-11 13:30:37
【问题描述】:
我有一个基于 libuvccamera 库的 Android 应用程序。
我的问题是在将我的 SDK 升级到最新版本后出现的。
当我尝试“制作项目”时,它运行良好。
但是当我尝试运行该项目时,我收到以下错误消息:
错误:无法访问 FragmentActivity
找不到 android.support.v4.app.FragmentActivity 的类文件
注意:某些输入文件使用或覆盖已弃用的 API。
在这个特定的行中:
baseActivity.setPath(path);
这一行是这个函数的一部分:
public void handleUpdateMedia(final String path) {
if (DEBUG) Log.v(TAG_THREAD, "handleUpdateMedia:path=" + path);
mHandler.setPath(path);
final Activity parent=mWeakParent.get();
BaseActivity baseActivity=(BaseActivity) parent;
if (baseActivity != null) {
baseActivity.setPath(path);
}
final boolean released=(mHandler == null) || mHandler.mReleased;
if (parent != null && parent.getApplicationContext() != null) {
try {
if (DEBUG) Log.i(TAG, "MediaScannerConnection#scanFile");
MediaScannerConnection.scanFile(parent.getApplicationContext(), new String[]{path}, null, null);
} catch (final Exception e) {
Log.e(TAG, "handleUpdateMedia:", e);
}
if (released || parent.isDestroyed())
handleRelease();
} else {
Log.w(TAG, "MainActivity already destroyed");
// give up to add this movie to MediaStore now.
// Seeing this movie on Gallery app etc. will take a lot of time.
handleRelease();
}
}
位于usbCameraCommon 库(libuvccamera 库使用的库之一)中。
还有其他人遇到过这种问题吗?
谢谢
【问题讨论】:
-
您的 libuvccamera 正在使用已在最新支持库中删除的已弃用的 FragmentActivity 类。您需要使用 AppCompatActivity 对其进行更新。
标签: android-studio android-gradle-plugin android-fragmentactivity