【问题标题】:Youtube Watchme android application errorYoutube Watchme android 应用程序错误
【发布时间】:2015-12-15 03:33:45
【问题描述】:

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

【问题讨论】:

    标签: android api youtube-api live-streaming youtube-livestreaming-api


    【解决方案1】:

    我认为你只导入 Jni 库你需要导入其他库也那个 .so 文件,Click Here

    【讨论】:

    • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
    • 在此链接中,您可以看到 youtube 直播所需的屏幕截图和库。
    【解决方案2】:

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

    【讨论】:

    • 是的,我正在使用 System.loadLibrary("ffmpeg"); Ffmpeg.java 文件中的代码 我在上面的部分中更新了代码。有什么问题吗?
    • 你没有编译过ffmpeg.so文件
    • 我能做些什么呢?我是 android 开发的新手。你能解释一下吗
    • 这里有一个帖子告诉你如何为Android编译FFmpeg:vec.io/posts/how-to-build-ffmpeg-with-android-ndk
    • 我正在使用带有 android studio 的 windows 机器。如何为 android studio 做这些更改?
    猜你喜欢
    • 2017-10-24
    • 1970-01-01
    • 2023-03-27
    • 1970-01-01
    • 2012-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多