将自定义SO文件导入AOSP(importing custom SO file to AOSP)
我按照本教程构建了一个AOSP系统服务: http : //www.androidenea.com/2009/12/adding-system-server-to-android.html
现在我想使用预编译的.so文件,无法确定放在哪里,以便我的代码能够访问它。
所以,我在framewaork / base / libs / my_folder /创建了一个文件夹,并将两个文件放在一起:my_lib.so android.mk
android.mk的内容是:
LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE:= my_lib LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY)
make运行没有错误,但是当代码试图通过以下方式加载库时:System.loadLibrary(“my_lib”);
我收到了这个错误:
06-27 13:58:55.581:E / AndroidRuntime(806):引起:java.lang.UnsatisfiedLinkError:找不到库my_lib; 试过[/vendor/lib/my_lib.so,/system/lib/my_lib.so]
所以我将so文件添加到out / target / product / generic / system / lib但是得到了同样的错误。
那么我应该在哪里放置my_lib.so文件? 并且是它需要的android.mk? 也许我应该在系统的某个地方注册?
提前致谢!
I've built an AOSP system service following this tutorial: http://www.androidenea.com/2009/12/adding-system-server-to-android.html
Now I want to use a pre-compiled .so file and cannot figure out where to put it so my code will be able to access it.
so, i created a folder at framewaork/base/libs/my_folder/ and put there two files: my_lib.so android.mk
the content of the android.mk is :
LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE:= my_lib LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY)
the make ran without errors, but when the code tried to load the library via: System.loadLibrary("my_lib");
i got this error:
06-27 13:58:55.581: E/AndroidRuntime(806): Caused by: java.lang.UnsatisfiedLinkError: Library my_lib not found; tried [/vendor/lib/my_lib.so, /system/lib/my_lib.so]
so i added the so file to out/target/product/generic/system/lib but got the same error.
so where should i place the my_lib.so file ? and is an android.mk needed for it ? maybe i should register it somewhere on the system ?
Thanks in advance!
原文:https://stackoverflow.com/questions/17345513
最满意答案
MS Access数据库的备份是文件副本。
从baseDirectory开始,使用Path.Combine,您可以构建包含baseDirectory和day的fullDirectory名称。 之后,您可以将文件(File.Copy)复制到该目录(最终使用Path.Combine构建文件的fullPath)。 不要忘记在复制文件之前处理连接,并确保在复制时没有人使用该文件。
编辑
using System; using System.IO; public class Program { public static void Main() { string baseDirectory = "C:\\Insert\\Your\\Base\\Directory"; string mdbSourceFilePath = "C:\\Directory\\Of\\mdb\\MyAccessDb.accdb"; string mdbTargetFileName = "MyAccessDb.bk"; string fullDirectory = Path.Combine(baseDirectory, DateTime.Today.ToString("dddd")); if (!Directory.Exists(baseDirectory)) Directory.CreateDirectory(baseDirectory); if (!Directory.Exists(fullDirectory)) Directory.CreateDirectory(fullDirectory); string mdbTargetFilePath = Path.Combine(fullDirectory, mdbTargetFileName); File.Copy(mdbSourceFilePath, mdbTargetFilePath); } }
Backup of MS Access database is a file copy.
Starting from a baseDirectory, with Path.Combine you can build a fullDirectory name containing the baseDirectory and the day. After that you can copy the file (File.Copy) to that directory (eventually using Path.Combine to build a fullPath of the file). Don't forget to Dispose the connection before copying the file and be sure the no one is using the file when you make the copy.
EDIT
using System; using System.IO; public class Program { public static void Main() { string baseDirectory = "C:\\Insert\\Your\\Base\\Directory"; string mdbSourceFilePath = "C:\\Directory\\Of\\mdb\\MyAccessDb.accdb"; string mdbTargetFileName = "MyAccessDb.bk"; string fullDirectory = Path.Combine(baseDirectory, DateTime.Today.ToString("dddd")); if (!Directory.Exists(baseDirectory)) Directory.CreateDirectory(baseDirectory); if (!Directory.Exists(fullDirectory)) Directory.CreateDirectory(fullDirectory); string mdbTargetFilePath = Path.Combine(fullDirectory, mdbTargetFileName); File.Copy(mdbSourceFilePath, mdbTargetFilePath); } }
相关问答
更多-
对Access数据库(或任何单个文件数据库)进行备份的最简单方法是简单地复制文件。 但要小心异常,因为该文件可能被锁定。 System.IO.File.Copy( _ "C:\Your\original\database.mdb", _ String.Format("D:\BackUps\{0:yyyyMMdd}.mdb", Date.Today) _ ) 此外,您可以允许用户指定文件应复制到的位置和文件名。 这是一个相当简单的方法,只需使用System.Windows.Forms控件Op ...
-
在C#中访问数据库备份(Access DB backup in C#)[2023-05-18]
你需要围绕字符串的引号 private void BackupDatabase_Click(object sender, RoutedEventArgs e) { File.Copy("Books_NE.mdb", "Books_NEBak.mdb", true); } You need quotes around strings private void BackupDatabase_Click(object sender, RoutedEvent ... -
您可以使用 Kill (strPath) 从磁盘中删除文件,其中strPath是文件的路径。 根据需要重复。 You can use Kill (strPath) to delete a file from disk, where strPath is the path to the file. Repeat as necessary.
-
请参阅此链接使用共享文件夹 IWHSInfo2 info = new WHSInfoClass(); IShareInfo2 share = info.CreateShare("SharedFolderName", "SharedFolderDescription", 0); WHSUserPermission perm1 = new WHSUserPermission(); perm1.userName = "User1"; perm1.permission = WHSSharePermissi ...
-
您可以使用简单地将访问数据库文件复制到另一个位置作为备份的选项。 它可以如下完成: File.Copy(sourceDbName, destDbName, true); 要么 您可以添加一个简单的例程,将您的输入数据库,压缩并存储在备份目录中,可选地传递密码,如下所示: using Ionic.Zip; ...... private void BackupToZip(string sourceDBName, string destZipFile, string password) { using ...
-
MS Access数据库的备份是文件副本。 从baseDirectory开始,使用Path.Combine,您可以构建包含baseDirectory和day的fullDirectory名称。 之后,您可以将文件(File.Copy)复制到该目录(最终使用Path.Combine构建文件的fullPath)。 不要忘记在复制文件之前处理连接,并确保在复制时没有人使用该文件。 编辑 using System; using System.IO; public class Program { public ...
-
要从iTunes文件共享中隐藏您的应用程序,您可以在info.plist中将以下键设置为No 。 应用程序支持iTunes文件共享 或者,在您的文件名/目录前面添加一个带有的Documents目录. 隐藏它而不禁用iTunes文件共享。 例如.folderName 。 使用此选项来阻止iCloud备份,从防止备份到iCloud,是否遵循正确的代码? - (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *)filePathString { NSUR ...
-
如何在使用命令行压缩文件夹时跳过“访问被拒绝”文件夹?(How to skip “Access Denied” Folder when zip folder with command-line?)[2023-04-20]
启动WinRAR并单击帮助主题菜单上的帮助 。 在标签上内容打开列表项命令行模式 。 首先阅读帮助页面命令行语法 。 接下来打开子菜单项切换并单击项目按字母顺序切换列表 。 在阅读WinRAR GUI版本的可用开关列表时,构建命令行。 例如: "%ProgramFiles(x86)%\WinRAR\WinRAR.exe" a -ac -agYYYY-MM-DD -cfg- -ep1 -ibck -inul E:\Backup C:\NeedBackup\ 注1: Switch -inul隐式启用-y ,这 ... -
MS Access VBA确定是否可以访问SharePoint文件夹(MS Access VBA determine if a SharePoint folder is accessible)[2022-01-07]
不确定,但这可能有用..尝试用xmlhttp对象读取页面,这应该等待状态...设置对Microsoft XML的引用,或者如果你喜欢的话后期绑定... Function TestURL(url As String) As Boolean On Error GoTo errhandler Dim httpObject As New XMLHTTP With httpObject .Open "GET", url, False .send If .Ready ... -
只需执行SQL Server 命令 BACKUP DATABASE database_name TO DISK='d:\path\to\backup\file\on\the\server.bak' Just execute SQL Server command BACKUP DATABASE database_name TO DISK='d:\path\to\backup\file\on\the\server.bak'