使用ProGuard隐藏代码中的URL

时间:2016-06-23 04:40:46

标签: java android

我的Java类中有一个URL代码。我在Android Studio中以这种方式使用ProGuard。但是,当我提取apk时,我看到URL仍然可见。如何在我的Android代码中隐藏URL以获取安全措施?

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "com.example.myapp"
        minSdkVersion 10
        targetSdkVersion 22
        multiDexEnabled true
        versionCode 26
        versionName "1.25"
        generatedDensities = []
    }
    // This is handled for you by the 2.0+ Gradle Plugin
    // This is handled for you by the 2.0+ Gradle Plugin
    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'}

proguard-rules.pro:

-dontwarn com.google.android.gms.*
-dontwarn org.apache.http.**
-dontwarn android.net.http.AndroidHttpClient
-dontwarn com.google.android.gms.**
-dontwarn com.android.volley.toolbox.**

0 个答案:

没有答案