StringCare / AndroidLibrary

Android library to reveal or obfuscate strings and assets at runtime
Apache License 2.0
247 stars 44 forks source link

The new version 0.7 does not apply plugin #32

Closed Narvelan closed 6 years ago

Narvelan commented 6 years ago

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 =(

Narvelan commented 6 years ago

if i set stringcare_version = '0.6' or '0.5', gradle output show error

java.lang.NullPointerException
    at AES.generateKey(AES.java:18)
    at AES.encrypt(AES.java:30)
    at FileUtils.find(FileUtils.java:231)
    at FileUtils.encryptStringResources(FileUtils.java:123)
    at FileUtils$encryptStringResources$0.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:149)
    at StringCare$1.onMergeResourcesStarts(StringCarePlugin.groovy:84)
    at GradleHandlerCallback$onMergeResourcesStarts$1.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
    at TListener.beforeExecute(TaskListener.groovy:54)
    at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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:371)
    at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:353)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:341)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:328)
    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.$Proxy109.beforeExecute(Unknown Source)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:244)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)

what i forgot to do? did as it is written in readme

efraespada commented 6 years ago

Hi @Narvelan! Thanks for report it. As I can see in your logs, mergeDebugResources is called on app module but plugin doesn't work. Show me what this commands print:

./gradlew signingReport

and

./gradlew build
Narvelan commented 6 years ago

I'm not sure where write gradlew command, in terminal?

C:\Users\ASUS\AndroidStudioProjects\MyApp>gradlew build
Starting a Gradle Daemon, 1 busy and 1 incompatible Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 1572864KB object heap

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

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

2018-03-13_123212

@efraespada maybe login with team viewer will be faster?

efraespada commented 6 years ago

Sorry, I didn't notify you use Windows, invoke Gradle with gradlew.bat <command> instead of ./gradlew .... I see 1 busy and 1 incompatible Daemons could not be reused. Run gradlew.bat stop, it should stop all pending process. Then, rebuild project.

Narvelan commented 6 years ago

I rewrite gradle.properties setting org.gradle.jvmargs=-Xmx512M (old value -> org.gradle.jvmargs=-Xmx1536M) and now gradlew.bat signingReport works.

efraespada commented 6 years ago

@Narvelan and did you stop all Gradle process? Rebuild your project and show me the result

Narvelan commented 6 years ago

It's work =)

Executing tasks: [:app:assembleDebug]

Configuration on demand is an incubating feature. :app:buildInfoDebugLoader :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 Module: app Variant: debug Store: C:\Users\ASUS\Desktop\1\MyApp.jks SHA1: E6:B3:63:63:54:C0:E0:A4:7E:26:87... Valid until: 31 декабря 2041 г. :app:debug:E6:B3:63:63:54:C0:E0:A4:7E:26:8:... :app:backupStringResources

BUILD SUCCESSFUL in 1m 5s 44 actionable tasks: 23 executed, 21 up-to-date

now it work, thanks for help

efraespada commented 6 years ago

Thanks to you! @Narvelan