【问题标题】:Cordova - How to hide asset folder in .apk?Cordova - 如何在 .apk 中隐藏资产文件夹?
【发布时间】:2015-03-15 06:07:23
【问题描述】:

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

如何隐藏 .apk 中的资产?

【问题讨论】:

标签: android cordova directory apk assets


【解决方案1】:

如果您在 .apk 上没有资产,那么当您安装应用程序时,它们怎么会在设备中?当然,这些都需要可用,正如 Cordova 的 security guide 上所说的那样:

不要假设您的源代码是安全的

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

在设备上安装应用程序后,您当然可以从在线下载资产,甚至可以使用File plugin 之类的方式将其存储以供离线使用,但这是完全不同的情况,甚至可能不是您想要的做。

【讨论】:

    【解决方案2】:
    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";
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多