如何更改包名称,而包括本地库 [英] How do I change the package name while including native libraries

查看:248
本文介绍了如何更改包名称,而包括本地库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提供的 HTTP://ikaruga2.word$p$pss.com/2011/08/10/video-live-wallpaper-part-4/ 。从本质上讲,这个应用程序是使用FFmpeg的逐帧读取视频文件框架和使用GLWallpaperService播放出画面的动态壁纸。

I have an Android project based upon the fantastic code available at http://ikaruga2.wordpress.com/2011/08/10/video-live-wallpaper-part-4/. Essentially, this app is a live wallpaper that uses FFMpeg to read a video file frame by frame and play it out to screen using GLWallpaperService.

我下载了code,并能得到它我的手机上成功运行。我做了一些改动,然后在多个设备再次检测,所有工作得很好。今天晚上我试图将包的名字从ffvideolivewallpaper.frankandrobot.com到com.nightscapecreations.orionkeysfree的转变。我做了搜索,并在java,c和XML文件替换替换它们。我还修改了C文件与Java_com_nightscapecreations_orionkeysfree_NativeCalls取代Java_ffvideolivewallpaper_frankandrobot_com_NativeCalls。然而,当我跑我的手机上的应用程序,现在我收到此错误:

I downloaded the code and was able to get it running successfully on my phone. I made several changes and then tested again on several devices and all worked fine. This evening I tried to change the package name from "ffvideolivewallpaper.frankandrobot.com" to "com.nightscapecreations.orionkeysfree". I did a search and replace in the java, c, and xml files to replace them. I also modified the c file to replace "Java_ffvideolivewallpaper_frankandrobot_com_NativeCalls" with "Java_com_nightscapecreations_orionkeysfree_NativeCalls". However, when I run the app on my phone now I receive this error:

09-30 12:53:44.911: E/AndroidRuntime(24237):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
09-30 12:53:44.911: E/AndroidRuntime(24237):     at dalvik.system.NativeStart.main(Native Method)
09-30 12:53:44.911: E/AndroidRuntime(24237): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1936]:   145 could not load needed library '/data/data/ffvideolivewallpaper.frankandrobot.com/lib/libavutil.so' for 'libavcore.so' (load_library[1091]: Library '/data/data/ffvideolivewallpaper.frankandrobot.com/lib/libavutil.so' not found)
09-30 12:53:44.911: E/AndroidRuntime(24237):     at java.lang.Runtime.loadLibrary(Runtime.java:370)
09-30 12:53:44.911: E/AndroidRuntime(24237):     at java.lang.System.loadLibrary(System.java:535)
09-30 12:53:44.911: E/AndroidRuntime(24237):     at com.nightscapecreations.orionkeysfree.NativeCalls.<clinit>(NativeCalls.java:64)
09-30 12:53:44.911: E/AndroidRuntime(24237):     ... 13 more

我假设有给我的思念某处老包名的引用,但我不能找到Eclipse的文件搜索任何东西。 Eclipse是管理NDK和编译所有的库和C code我。到目前为止,我已经试过:

I'm assuming there's a reference to the old package name that I'm missing somewhere, but I can't find anything with Eclipse's file search. Eclipse is managing the NDK and compiling all the libraries and c code for me. So far I've tried:


  • 做一个干净的构建

  • 重新启动Eclipse的

  • 删除再次在libs目录和建筑的一切

本机调用文件时示数如下所示:

The native calls file that is erroring looks like this:

package com.nightscapecreations.orionkeysfree;

public class NativeCalls {
    //ffmpeg
    public static native void initVideo();
    public static native void loadVideo(String fileName); //
    public static native void prepareStorageFrame();
    public static native void getFrame(); //
    public static native void freeConversionStorage();
    public static native void closeVideo();//
    public static native void freeVideo();//
    //opengl
    public static native void initPreOpenGL(); //
    public static native void initOpenGL(); //
    public static native void drawFrame(); //
    public static native void closeOpenGL(); //
    public static native void closePostOpenGL();//
    //wallpaper
    public static native void updateVideoPosition();
    public static native void setSpanVideo(boolean b);
    //getters
    public static native int getVideoHeight();
    public static native int getVideoWidth();
    //setters
    public static native void setWallVideoDimensions(int w,int h);
    public static native void setWallDimensions(int w,int h);
    public static native void setScreenPadding(int w,int h);
    public static native void setVideoMargins(int w,int h);
    public static native void setDrawDimensions(int drawWidth,int drawHeight);
    public static native void setOffsets(int x,int y);
    public static native void setSteps(int xs,int ys);
    public static native void setScreenDimensions(int w, int h);
    public static native void setTextureDimensions(int tx,
                           int ty );
    public static native void setOrientation(boolean b);
    public static native void setPreviewMode(boolean b);
    public static native void setTonality(int t);
    public static native void toggleGetFrame(boolean b);
    //fps
    public static native void setLoopVideo(boolean b);

    static {
    System.loadLibrary("avcore");
    System.loadLibrary("avformat");
    System.loadLibrary("avcodec");
    //System.loadLibrary("avdevice");
    System.loadLibrary("avfilter");
    System.loadLibrary("avutil");
    System.loadLibrary("swscale");
    System.loadLibrary("video");
    }

}

我如何解决这个问题?改变包的名称时,还有什么需要做起来难?我需要在未来做了很多次。

How do I resolve this error? What else needs done when changing the package name? I'll need to do this many times in the future.

搜索结果
修改

它看起来像我一直在寻找在错误的地方。的code的原始版本的开发者指出,有编制的ffmpeg库时传入包名。他很高兴编译一个新的版本,我用我的包名和壁纸完美。我们试图编译没有包名,但是当加入到应用程序,它只是造成了:

It looks like I was looking in the wrong place. The developer of the original version of the code pointed out that there is a package name passed in when compiling the ffmpeg libraries. He was nice enough to compile a new version for me with my package name and the wallpaper worked perfectly. We tried a compile without the package name, but when added to the app it just resulted in:

 10-04 08:20:57.414: E/AndroidRuntime(19139): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1936]:   145 could not load needed library 'libavutil.so' for 'libavcore.so' (load_library[1091]: Library 'libavutil.so' not found)

我猜,我只是需要每次我提出一个新的墙纸来编译一个新的版本。对于那些谁试图做同样的,我想指出的是,在这个项目中使用的ffmpeg的版本需要NDK版本5; 9版本将无法正常进行编译。

I'm guessing that I'll just need to compile a new version each time I make a new wallpaper. For those who are trying to do the same, I'd like to point out that the version of ffmpeg used in this project requires version 5 of the ndk; version 9 will not compile it correctly.

我已经接受了现有的答案,而不是加入我自己的,因为它不回答我的问题的原意,即使它并没有解决这个具体问题,我认为这可能是有帮助的其他新开发者。

I've accepted an existing answer instead of adding my own as it does answer the original intent of my question, even if it didn't resolve this specific issue, and I think it could be helpful to other new developers.

推荐答案

如果使用Eclipse,适当的方式重命名包是做到以下几点:右键单击项目 - > Android的工具 - >重命名应用程序包

If using Eclipse, the proper way to rename the package is to do the following: Right click on project -> Android Tools -> Rename Application Package.

这篇关于如何更改包名称,而包括本地库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆