0

我是 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);
}
4

2 回答 2

2

您应该编译FFmpeg库并将其放置在src/main/jniLibs/armeabi中,因为本机库应用程序尝试加载 System.loadLibrary("ffmpeg");

于 2015-09-18T05:29:59.730 回答
-1

我认为您只导入 Jni 库,您还需要导入其他库以及 .so 文件,单击此处

于 2016-10-20T10:46:36.137 回答