我是android开发的新手。我正在使用https://github.com/youtube/yt-watchme开发android应用程序。当开始直播时,它意外关闭。在我的android studio控制台中,我收到以下错误。
09-18 10:33:26.427 16692-16692/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.google.android.apps.watchme, PID: 16692
java.lang.UnsatisfiedLinkError: Couldn't load Ffmpeg from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.google.android.apps.watchme-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.android.apps.watchme-2, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at com.google.android.apps.watchme.Ffmpeg.<clinit>(Ffmpeg.java:26)
at com.google.android.apps.watchme.VideoStreamingConnection.open(VideoStreamingConnection.java:71)
at com.google.android.apps.watchme.StreamerService.startStreaming(StreamerService.java:80)
at com.google.android.apps.watchme.StreamerActivity.startStreaming(StreamerActivity.java:212)
at com.google.android.apps.watchme.StreamerActivity.access$200(StreamerActivity.java:47)
at com.google.android.apps.watchme.StreamerActivity$1.onServiceConnected(StreamerActivity.java:64)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1110)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1127)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5097)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
请帮我解决这个问题。我真的很困惑这个问题。
更新的代码:
/*
* Copyright (c) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.watchme;
/**
* @author Ibrahim Ulukaya <ulukaya@google.com>
* <p/>
* FFmpeg class which loads ffmpeg library and exposes its methods.
*/
public class Ffmpeg {
static {
System.loadLibrary("ffmpeg");
}
public static native boolean init(int width, int height, int audio_sample_rate, String rtmpUrl);
public static native void shutdown();
// Returns the size of the encoded frame.
public static native int encodeVideoFrame(byte[] yuv_image);
public static native int encodeAudioFrame(short[] audio_data, int length);
}
答案 0 :(得分:2)
您应该编译 FFmpeg 库并将其置于 src / main / jniLibs / armeabi 中,因为本机库应用程序会尝试加载
System.loadLibrary("ffmpeg");
答案 1 :(得分:-1)
我认为您只导入Jni库,您需要导入其他库.so文件,Click Here