NativeScript / nativescript-app-encryption

This plugin encrypts all your app/**.js files during a release build. In experimental state.
Apache License 2.0
35 stars 6 forks source link

com.tns.app_protection does not exist #9

Open priyangamani opened 7 years ago

priyangamani commented 7 years ago

D:\Sample\platforms\android\src\main\java\com\tns\RuntimeHe lper.java:57: error: package com.tns.app_protection does not exist com.tns.app_protection.AppProtection.setKey("qyUMQZhu43KByppjVJFJyRxVG+PZaRAHId2 +mczHiwo="); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error :compileF0F1F2F3F4F5F6F7F8F9F10F11F12F13F14F15F16ReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':compileF0F1F2F3F4F5F6F7F8F9F10F11F12F13F14F15F16Rele aseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

ju4nj3 commented 7 years ago

Use 0.3.0. It works. I tested it right now because I'm unable to get Webpack working. It breaks my code and I did everything possible I found. My vote to keep this project open.

zenz commented 7 years ago

second that vote, this is better than webpack and uglify

zenz commented 7 years ago

So this is the temp solution for this plugin, and this plugin has been deprecated but it's very useful and better than uglifyjs in webpack in personal opinion. It works for me.

after tns plugin install nativescript-app-encryption, navigate to node_modules/nativescript-app-encryption/hooks path. modify the file after-prepare.js comment out this part

// The hook is used only on iOS 
//if (hookArgs.platform != 'ios') { 
    //return; 
//}

do the tns prepare android create a folder named app_protection under platform/android/src/main/java/com/tns. create and edit a file named AppProtection.java copy and paste the code from https://github.com/NativeScript/nativescript-app-encryption/blob/master/native-src/android/app/src/main/java/com/tns/app_protection/AppProtection.java save and compile your code. That's it.