Giter VIP home page Giter VIP logo

androidlibrary's Introduction

Maven Central

StringCare Android Library

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

androidlibrary's People

Contributors

d-moreira avatar efraespada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androidlibrary's Issues

Execution failed for task ':app:generateDebugAssets'

Hi!

First of all thanks for your great work, awesome!

I'm trying to use your Lib, I've followed all the instructions but when I'm trying to obfuscate my asset folder I'm getting this error:

Screenshot 2020-10-05 at 22 19 32

Can you help me? I've tried a bunch of things, but I can't find the error.

Muchisimas gracias! 😄

Wiki update

Wonderful library!

Just wanted to point out that I tried following the Asset Usage wiki page:
https://github.com/StringCare/AndroidLibrary/wiki/Assets-Usage

And for me, retrieving the JSON objects (encrypted) from assets didn't work.
My app kept crashing.

Later I found that I adding:

aaptOptions {
noCompress "json"
}

only worked, if I deleted the app from my device first.
Like a reset. Otherwise the noCompress isn't applied by Android Studio.

Could you perhaps add a line at the top of the page, telling fellow developers that they might have to delete their app first.
Something like:

"Before start, you'll need to configure the extensions not to be compressed.
And also don't forget to delete the app from your device first, otherwise aaptOptions won't work:"
Trying to help future devs :)

Once again, thank you.

Plugin doesn't obfuscate some strings

<string name="str1">2E8A34BAC54309D4B47866F998F6D3CBDA68D11C86481494A3DFE8531E273991</string> <string name="str2">Активные (%1$d)</string> <string name="str3">Новые (%1$d)</string>

Incorrect linebreaks

I'm using Android Studio 3.2 (Windows) with gradle 4.6 and stringcare 0.7, everytime I build my app String care removes all linebrakes from strings.xml making it a single line file.

Can't open the sample

When I clone the project and try to open it, I get this issue that has no error information, after I've tried to upgrade its gradle plugin (because it failed to build):

image

Android Studio Flamingo | 2022.2.1 Canary 10
Build #AI-222.4459.24.2221.9409768, built on December 15, 2022
Runtime version: 17.0.4.1+0-b2043.56-9127311 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 9048M
Cores: 12
Registry:
external.system.auto.import.disabled=true
debugger.watches.in.variables=false
ide.text.editor.with.preview.show.floating.toolbar=false
gradle.version.catalogs.dynamic.support=true
ide.images.show.chessboard=true

Non-Bundled Plugins:
idea.plugin.protoeditor (222.4459.16)
com.intellij.marketplace (222.4459.28)
com.dubreuia (2.3.0)
com.dethlex.numberconverter (1.5.0)
String Manipulation (9.6.1)
Show As ... (1.0.3)
GenerateSerializationHelpers (1.0.6)
GenerateSerialVersionUID (3.0.3)
com.google.mad-scorecard (1.2)
com.developerphil.adbidea (1.6.8)
net.aquadc.mike.plugin (0.27)
izhangzhihao.rainbow.brackets (2022.3.5-ij)
com.ppismerov.ksvu (0.0.1)

java.lang.NoClassDefFoundError: Could not initialize class components.Stark

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugResources'.
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:69)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify task execution listener.
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:86)
	at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:346)
	at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:333)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
	at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
	at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
	at com.sun.proxy.$Proxy121.beforeExecute(Unknown Source)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:62)
	... 23 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class components.Stark
	at components.XParserKt.obfuscateStringEntity(XParser.kt:109)
	at components.XParserKt.modifyXML(XParser.kt:97)
	at StringCare$apply$3$1.invoke(StringCare.kt:109)
	at StringCare$apply$3$1.invoke(StringCare.kt:7)
	at components.FingerprintKt$fingerPrint$1.invoke(Fingerprint.kt:92)
	at components.FingerprintKt$fingerPrint$1.invoke(Fingerprint.kt)
	at components.ExtensionsKt.runCommand(Extensions.kt:29)
	at components.FingerprintKt.fingerPrint(Fingerprint.kt:91)
	at StringCare$apply$3.invoke(StringCare.kt:84)
	at StringCare$apply$3.invoke(StringCare.kt:7)
	at components.ExecutionListener.beforeExecute(ExecutionListener.kt:30)
	at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingInvocationHandler.invoke(DefaultListenerBuildOperationDecorator.java:228)
	at com.sun.proxy.$Proxy165.beforeExecute(Unknown Source)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:376)
	at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:358)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
	... 33 more

Build: failed: Index: 1, Size: 1

I tried to build the Kotlin sample project (link), but the following error was thrown during build:

Task :app:mergeDevDebugResources FAILED
	Module: app
	ApplicationId: com.stringcare.sample

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDevDebugResources'.
> Index: 1, Size: 1

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDevDebugResources'.
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:370)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:357)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:350)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
	at components.Fingerprint.extract(Fingerprint.kt:48)
	at components.FingerprintKt.extractFingerprint(Fingerprint.kt:97)
	at components.FingerprintKt$fingerPrint$1.invoke(Fingerprint.kt:89)
	at components.FingerprintKt$fingerPrint$1.invoke(Fingerprint.kt)
	at components.ExtensionsKt.runCommand(Extensions.kt:35)
	at components.FingerprintKt.fingerPrint(Fingerprint.kt:88)
	at StringCare$apply$3.invoke(StringCare.kt:64)
	at StringCare$apply$3.invoke(StringCare.kt:6)
	at components.ExecutionListener.beforeExecute(ExecutionListener.kt:30)
	at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingInvocationHandler.invoke(DefaultListenerBuildOperationDecorator.java:226)
	at com.sun.proxy.$Proxy150.beforeExecute(Unknown Source)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:382)
	at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:364)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
	at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:352)
	at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:339)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:244)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:156)
	at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:141)
	at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at com.sun.proxy.$Proxy161.beforeExecute(Unknown Source)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:66)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:370)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:357)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:350)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)

This problem doesn't seem to be limited to the sample project either. I followed the "Implementation" and "Strings Usage" wiki pages to add StringCare to an existing app and it surfaced the same error.

Any ideas of what might be causing this? Let me know if more information would be useful.

Bug: cannot handle build variants properly

Might be related to this issue.

I tried to make a sample that uses build-variants, and I still fail to do it.
I used all articles about it, and looked at samples too.

Even so, what I got to have is either not showing the strings correctly, or crashes (during runtime or errors while building).

That's even though without StringCare all works perfectly fine, just like on the samples I've found.

I've made here a very tiny sample with build-variants , and without StringCare being used.
The sample only has a single string that is the only thing (apart from package name and app-name) different between the build-variants.
The string is supposed to be protected by StringCare.

With StringCare:

MyApplication with StringCare.zip

And here is the same sample without StringCare:

MyApplication without StringCare.zip

I've made a video showing the issues:

2019-06-26_09-45-33.zip

Gradle crash

Gradle always crashes while using this obfuscator:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

Hidden tag not detected at compilation time. Gradle 4.1

<string name="test" hidden="true">test</string>
:app:obfuscator-script - ----------------------------------------------------
:app:obfuscator-script - devDebug variant
:app:obfuscator-script - SHA1 fingerprint: B7:D5:47:57:9B:5F:2C:21:95:C4:0..
:app:obfuscator-script - ----------------------------------------------------
:app:obfuscator-script - v 0.7

* What went wrong: 1

'C:\sdk\sdk\sdk\build-tools\android-4.3' (Expected 'C:\sdk\sdk\sdk\build-tools\18.1.0')
XML document structures must start and end within the same entity.:
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 468; XML document structures must start and end within the same entity.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong:
    1

2: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:buildInfoGeneratorDebug'.

Full build with no artifacts. This should not happen.

Can't get it to work

What should I put in variant parameter? I tried the following but it doesn't seem to work.

args = [
    "../AndroidStringObfuscator.jar",
    "app",
    "../debug",
    "E1:28:0C:3E:65:91:2E:21:E9:98:2B:58:80:9A:25:3A:F6:88:7D:FF"
]

Gradle console output

:app:obfuscator-script - -----------------------------------------------------------------------------
:app:obfuscator-script - SHA1 fingerprint: E1:28:0C:3E:65:91:2E:21:E9:98:2B:58:80:9A:25:3A:F6:88:7D:FF
:app:obfuscator-script - -----------------------------------------------------------------------------
:app:obfuscator-script - v 0.6

No string is encrypted (string resources). I also tried your sample app but it didn't work either

Not Working with Signed Apk

This works like a charm when testing on local environment. When I generated Signed apk, the Strings does not get decrypted.

Source folder not found when encrypting string resources

Hello,

I have a project setup to run and encrypt string resources located on a file root_project/module_name/src/main/res/values/secrets.xml. This works perfectly with:

a root_project/build.gradle that looks like

...

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath "com.efraespada:stringobfuscatorplugin:0.5.0"
        ...
    }
}
apply plugin: com.efraespada.stringobfuscatorplugin.StringObfuscatorPlugin

and a root_project/app/build.gradle that looks like:

repositories {
    jcenter()
} 
 
dependencies {
    compile "efraespada:androidstringobfuscator:0.5.0"
}

But in another machine, when running the same project, it seems that the plugin is not able to find the path to root_project/app/src/main/res/values. I can see this on the gradle console:

:app:backupStringResources
    source folder not found: src/main/res
    source folder not found: values
:app:encryptStringResources
    source folder not found: src/main/res
    source folder not found: values

Any idea on how to fix this? Thanks

Error parsing commented string resource with hidden attribute

<resources>
    <!--string name="value" hidden="true">value A</string-->
    <string name="value" hidden="true">value B</string>
</resources>

Commented lines produces the following compilation error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> values/strings.xml:1:3971: Error: XML document structures must start
and end within the same entity.

I'll fix it but for now remove hiddenattribute on commented lines.

Plugin not working when I make aar library (com.android.library)

When I make aar library, encrypted string is not included in aar files.

After completion of library module build,
I open and check values.xml files under location : 'module'\build\intermediates\res\merged'variant''buildType'\values
Strings are all encrypted as well.

but, It seems that 'res\values.xml' file in aar library is not encrypted (original file itself?)
Is there any missing point?

Avoid reverse engineering

Hi, i use this library to encrypt string resource. With smali after decompiling app it's very easy to see original value. How can avoid reverse engineering ?

null reference after sign application

i use this lib to encrypt my strings.
Everything working ok on emulator but when i sign the application and running the app on mobile when decrypt the string the result is NULL
Thank for any help

StringCare do not work with gradle flavors

StringCare do not work with Gradle Flavors.

Set two build flavors, the first with a signing config and the second without, on the first build everything will work fine, on the second build all string will not decrypt anymore.

build >>>> build again -> breaks string care if you use gradle flavors.

String does not decrypt

Good evening. We use your library
in one application and we deal with a problem. The library works perfect in signed realese version but when it is published in the play store the string does not become decrypt. Have you any ideas for this situation? Thanks in advance!

Obfuscation library

Would it be possible to have a different obfuscation dictionary for each different build?

IllegalBlockSizeException when decrypting

Hi @efraespada,

I'm getting an error when decrypting a string like asd=\\n. Here is the log:

javax.crypto.IllegalBlockSizeException: error:1e00007b:Cipher functions:OPENSSL_internal:WRONG_FINAL_BLOCK_LENGTH
at com.android.org.conscrypt.NativeCrypto.EVP_CipherFinal_ex(Native Method)
at com.android.org.conscrypt.OpenSSLCipher$EVP_CIPHER.doFinalInternal(OpenSSLCipher.java:570)
at com.android.org.conscrypt.OpenSSLCipher.engineDoFinal(OpenSSLCipher.java:351)
at javax.crypto.Cipher.doFinal(Cipher.java:1736)
at com.stringcare.library.SC.decrypt(SC.java:118)
at com.stringcare.library.SC.decryptString(SC.java:199)
at ...
at ...
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5791)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Can you investigate the issue? Maybe this can be solved by encoding/decoding the values using Base64... Thanks!

JCenter Deprecation

With the imminent closure of jcenter as a repo, isn't it a problem that this (excellent library :-) ) still uses it?

Android Studio (& therefore presumably Intellij IDEA) now recommend removing jcenter... compilations using this library fail when that happens

Strings are not obfuscated on build time

Hello,

I'm following https://github.com/efraespada/AndroidStringObfuscator/blob/master/README.md#gradle-implementation but the string resources are no longer obfuscated during build time (everything was working fine with these instructions https://github.com/efraespada/AndroidStringObfuscator/blob/3451745f18fdc97ca58b271d238eef60511b348b/README.md).

My root_project/build.gradle looks like:

...

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath "com.efraespada:stringobfuscatorplugin:0.4.1"
        ...
    }
}
apply plugin: com.efraespada.stringobfuscatorplugin.StringObfuscatorPlugin

and my root_project/app/build.gradle looks like:

repositories {
    jcenter()
} 
 
dependencies {
    compile "efraespada:androidstringobfuscator:0.4.1"
}

Am I missing something? How are the strings supposed to be obfuscated during build time after removing the AndroidStringObfuscator.jar and the code to use it?

Can I use CS hidden string in XML Layout?

When I write link to hidden string res in xml layout files
android:text="@string/glass"
The text remains encrypted, somehow we can use this strings in xml to show text decrypted?
Or only decrypt it in java code and after use settext

The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle

AGPBI: {"kind":"error","text":"Invoke-customs are only supported starting with Android O (--min-api 26)","sources":[{}],"tool":"D8"}
> Task :app:mergeExtDexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform artifact 'plugin.jar (com.stringcare:plugin:2.2)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.usage=java-runtime-jars}
      > Execution failed for DexingTransform: /Users/e-enea/.gradle/caches/modules-2/files-2.1/com.stringcare/plugin/2.2/106d0e7558bad3428183dfe0fb0cec1fefc337d6/plugin-2.2.jar.
         > Error while dexing.
           The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle
           android {
               compileOptions {
                   sourceCompatibility 1.8
                   targetCompatibility 1.8
               }
           }
           See https://developer.android.com/studio/write/java8-support.html for details. Alternatively, increase the minSdkVersion to 26 or above.
   > Failed to transform artifact 'groovy.jar (org.codehaus.groovy:groovy:2.5.4)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.usage=java-runtime-jars}
      > Execution failed for DexingTransform: /Users/e-enea/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.5.4/86b94e2949bcff3a13b7ad200e4c5299b52ad994/groovy-2.5.4.jar.
         > Error while dexing.
   > Failed to transform artifact 'junit-platform-launcher.jar (org.junit.platform:junit-platform-launcher:1.3.1)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.usage=java-runtime-jars}
      > Execution failed for DexingTransform: /Users/e-enea/.gradle/caches/modules-2/files-2.1/org.junit.platform/junit-platform-launcher/1.3.1/8a07cb776e5aeb320b051183dc8ff142650ddb4e/junit-platform-launcher-1.3.1.jar.
         > Error while dexing.
   > Failed to transform artifact 'junit-jupiter-engine.jar (org.junit.jupiter:junit-jupiter-engine:5.3.1)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.usage=java-runtime-jars}
      > Execution failed for DexingTransform: /Users/e-enea/.gradle/caches/modules-2/files-2.1/org.junit.jupiter/junit-jupiter-engine/5.3.1/e2676b1786c57a80eb98f5bebd51a3d05e228c40/junit-jupiter-engine-5.3.1.jar.
         > Error while dexing.
   > Failed to transform artifact 'junit-platform-engine.jar (org.junit.platform:junit-platform-engine:1.3.1)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.usage=java-runtime-jars}
      > Execution failed for DexingTransform: /Users/e-enea/.gradle/caches/modules-2/files-2.1/org.junit.platform/junit-platform-engine/1.3.1/3ee68a06bbdab157dd260e2095c356481d6cd172/junit-platform-engine-1.3.1.jar.
         > Error while dexing.
   > Failed to transform artifact 'junit-jupiter-api.jar (org.junit.jupiter:junit-jupiter-api:5.3.1)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.usage=java-runtime-jars}
      > Execution failed for DexingTransform: /Users/e-enea/.gradle/caches/modules-2/files-2.1/org.junit.jupiter/junit-jupiter-api/5.3.1/a7e97eac2784395cb991403f9641b042ad972941/junit-jupiter-api-5.3.1.jar.
         > Error while dexing.
   > Failed to transform artifact 'junit-platform-commons.jar (org.junit.platform:junit-platform-commons:1.3.1)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.usage=java-runtime-jars}
      > Execution failed for DexingTransform: /Users/e-enea/.gradle/caches/modules-2/files-2.1/org.junit.platform/junit-platform-commons/1.3.1/67b7edddfac1935e6e6d9b58d7c7df6db59b1d39/junit-platform-commons-1.3.1.jar.
         > Error while dexing.
           The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle
           android {
               compileOptions {
                   sourceCompatibility 1.8
                   targetCompatibility 1.8
               }
           }
           See https://developer.android.com/studio/write/java8-support.html for details. Alternatively, increase the minSdkVersion to 26 or above.

java.lang.ArrayIndexOutOfBoundsException on Gradle 4.1

:app:obfuscator-script - -----------------------------------------------------------------------------

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
	at main.Core.parseTrace(Core.java:295)
	at main.Core.getKey(Core.java:261)
	at main.Core.main(Core.java:68)

:app:mergeDebugResources FAILED

The new version 0.7 does not apply plugin

plugin does not apply how i see gradle console android studio 3.0.1

Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]

Configuration on demand is an incubating feature.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
Configuration 'testCompile' in project ':app' is deprecated. Use 'testImplementation' instead.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:preDebugAndroidTestBuild
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestResValues
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:splitsDiscoveryTaskDebugAndroidTest
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:mockableAndroidJar

BUILD SUCCESSFUL in 16s
22 actionable tasks: 10 executed, 12 up-to-date

gradle1

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        stringcare_version = '0.7'
    }

    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "com.stringcare:plugin:$stringcare_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply plugin: StringCare

stringcare {
    debug true  // prints details

    modules {
        sample {
            stringFiles = ['strings.xml',"other_file.xml"]
            srcFolders = ['src/main', "src/main/res/values"]
        }

        other_module {
            srcFolders = ['src/moduleB']
        }

        other_module_ {}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

**gradle2.**
apply plugin: 'com.android.application'

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
        maven { url "https://jitpack.io" }
    }
}

android {
    signingConfigs {
        config {
            keyAlias 'xxxxx'
            keyPassword 'xxx'
            storeFile file('C:/Users/ASUS/Desktop/1/xxx.jks')
            storePassword 'xxx'
        }
    }
    compileSdkVersion 27
    defaultConfig {
        applicationId "ru.xxx.xxx"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        externalNativeBuild {
            cmake {
                cppFlags "-std=c++14 -frtti"
            }
        }
    }
    buildTypes {
        debug {
            minifyEnabled false
            //useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            jniDebuggable true
            signingConfig signingConfigs.config
        }
        release {
            shrinkResources true
            minifyEnabled true
//            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
        }
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
}

configurations {
    all*.exclude group: 'commons-logging', module: 'commons-logging'
}

dependencies {
    implementation "com.stringcare:library:$stringcare_version"
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/android-async-http-1.4.9.jar')
    compile files('libs/httpclient-4.3.6.jar')
    compile 'com.google.android.gms:play-services-vision:11.8.0'
    compile 'com.android.support:appcompat-v7:27.0.2'
    compile 'com.android.support:design:27.0.2'
    compile 'com.android.support:support-v4:27.0.2'
    compile 'com.android.support:cardview-v7:27.0.2'
    compile 'com.android.support:recyclerview-v7:27.0.2'
    compile 'com.android.support:preference-v7:27.0.2'
    compile 'com.android.support:preference-v14:27.0.2'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
    // implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
    compile 'com.j256.ormlite:ormlite-core:5.0'
    compile 'com.j256.ormlite:ormlite-android:5.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    dependencies { compile 'com.android.support:support-annotations:27.0.2' }
    testCompile 'junit:junit:4.12'
}

value/strings.xml contain
<string name="drower_profile_item" hidden="true">Профиль</string>

why does not work? @efraespada Help please, my contact https://t.me/hilaryon for online chat, but my english not very well =(

Task 'stringcareTestObfuscateDebug' not found in root project

Building APKs is not obfuscating with the 'hidden="true"' attribute in strings.

Version 4.0
Default config
Log:


>gradlew.bat stringcareTestObfuscateDebug
Configuration on demand is an incubating feature.

> Configure project :sources
WARNING: The following project options are deprecated and have been removed:
android.useDeprecatedNdk
NdkCompile is no longer supported


org.gradle.api.plugins.HelpTasksPlugin@1ccb4eb4
org.gradle.buildinit.plugins.BuildInitPlugin@4a04b75b
org.gradle.buildinit.plugins.WrapperPlugin@3472989a
com.android.build.gradle.internal.plugins.VersionCheckPlugin@4f4bcce0
com.android.build.gradle.api.AndroidBasePlugin@9338553
org.gradle.language.base.plugins.LifecycleBasePlugin@66e25541
org.gradle.api.plugins.BasePlugin@46f4a74f
org.gradle.api.plugins.ReportingBasePlugin@57495fbd
org.gradle.api.plugins.JavaBasePlugin@42c5511a
com.android.build.gradle.internal.plugins.AppPlugin@36f95c5e
com.android.build.gradle.AppPlugin@55545b11
StringCare@48fd42b1

FAILURE: Build failed with an exception.

* What went wrong:
Task 'stringcareTestObfuscateDebug' not found in root project 'Pro'.

* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s


Help?

Need explanation about migration from v0.9 to v1.2

We used the library in many places, using v0.9 . Example:

SC.getString(R.string.some_important_key)

<string name="some_important_key" hidden="true" translatable="false">abc</string>

Will this still work on v1.2 ? What exactly should we change it to?

I've read this:
https://github.com/StringCare/AndroidLibrary/wiki/Migrate-From-0.x-To-1.x

But I don't understand what to change it to.

Should it be just this from now:

SC.decryptString(getString(R.string.some_important_key))

Or :

SC.deobfuscate(R.string.some_important_key)

Or something else?

Are there other important things to know about?

I ask this all because the explanation seems worrying "strings and resources don't work in the same way." .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.