Cordova - 如何在.apk中隐藏资产文件夹?

时间:2015-01-16 15:28:29

标签: android cordova directory apk assets

我将 .apk 文件更改为 .zip 并在WinRAR上打开它。问题是显示 assets 文件夹,因此显示了我的JS和HTML文件。我正在使用Cordova开发我的应用程序。

如何隐藏 .apk 中的资产?

2 个答案:

答案 0 :(得分:0)

如果您没有 .apk 上的资产,那么在安装应用时它们如何才能进入设备?当然,那些需要提供的内容正如Cordova security guide所说的那样:

  

不要认为您的源代码是安全的

     

由于Cordova应用程序是根据打包在本机容器中的HTML和JavaScript资源构建的,因此您不应认为您的代码是安全的。可以对Cordova应用程序进行逆向工程。

在设备上安装应用程序后,您当然可以从在线下载资产,甚至可以将其存储为离线使用,例如File plugin,但这是完全不同的情况,甚至可能不是你的希望这样做。

答案 1 :(得分:0)

Cordova - How to hide asset folder in .apk

1)Encrypted all Cordova assets files. 
2)Decrypt the files and move to the internal storage during runtime.
3)Access your assets files from internal storage( this.getFilesDir().getAbsolutePath()).
Following these things will keep your file and method calling safe as they are accessible only 
to internal storage.

Replace launchUrl "android_asset" to "data/data/io.cordova.hellocordova/files/"

Example: modify the dev source.
1)  "file:///android_asset/www/index.html";   to  Replace     
    "file:///data/data/io.cordova.hellocordova/files/www/index.html";

2) "file:///android_asset/www/index.html"; to Replace  
   "file:///data/data/io.cordova.hellocordova/files/www/index.html";