android代码混淆aar

阅读: 评论:0

android代码混淆aar

android代码混淆aar

1、打包aar的工程

①l中不能有,如果有这个的话,在别的项目引用这个aar包之后,手机上会有两个图标

②adle中不能有apply plugin: 'com.android.application',需要改为apply plugin: 'com.android.library'

android打包aar步骤.png

arr包路径.png

image.png

别的项目引用aar包

aar包放在libs包下,同时adle文件中引入

image.png

image.png

2、关于地图引用百度sdk

引用的jar包有如下:

image.png

BaiduLBS_Android.jar放在libs包下,

arm64-v8a/

armeabi/

armeabi-v7a放在JniLibs包下

image.png

3、目前有maputil、CommonReportPage可以打包为aar

E:ASProjectandroidcommon

E:ASProject10trunkCommonReportPage

4、android打包签名包

Build→Generate Signed APK,注意versionname和versioncode

也要改

defaultConfig {

applicationId "com.jsptpd.srfa"

minSdkVersion 15

targetSdkVersion 25

versionCode 27

versionName "0.2.7"

ndk {

abiFilters "armeabi", "armeabi-v7a"

}

}

image.png

5、android打包签名包,混淆

buildTypes {

release { //发布版本使用混淆文件

minifyEnabled true

proguardFiles getDefaultProguardFile(&#'), 'proguard-rules.pro'

}

}

完整adle(Module:app)

apply plugin: 'com.android.application'

//apply plugin: 'android-apt'

def AAVersion = '4.0.0'

android {

compileSdkVersion 25

buildToolsVersion '26.0.2'

defaultConfig {

applicationId "com.jsptpd.srfa"

minSdkVersion 15

targetSdkVersion 25

versionCode 27

versionName "0.2.7"

ndk {

abiFilters "armeabi", "armeabi-v7a"

}

}

buildTypes {

release { //发布版本使用混淆文件

minifyEnabled true

proguardFiles getDefaultProguardFile(&#'), 'proguard-rules.pro'

}

}

compileOptions {

sourceCompatibility JavaVersion.VERSION_1_8

targetCompatibility JavaVersion.VERSION_1_8

}

// repositories {

// flatDir {

// dirs 'libs'

// }

//

// }

}

dependencies {

implementation 'com.straint:constraint-layout:1.1.0'

compile fileTree(include: ['*.jar'], dir: 'libs')

testCompile 'junit:junit:4.12'

compile(name: 'maputil-release', ext: 'aar')

compile(name: 'commonreportpage', ext: 'aar')

compile(name: 'compass-release', ext: 'aar')

compile(name: 'towerheightmeter-release', ext: 'aar')

annotationProcessor "org.androidannotations:androidannotations:$AAVersion"

compile "org.androidannotations:androidannotations-api:$AAVersion"

compile 'com.android.support:appcompat-v7:25.3.1'

compile &#obot:greendao:2.2.0'

compile 'fit2:retrofit:2.0.2'

compile 'fit2:converter-gson:2.0.2'

compile 'com.android.support:design:25.3.1'

compile 'com.android.support:support-v4:25.3.1'

compile 'com.github.stfalcon:frescoimageviewer:0.4.1'

compile 'com.facebook.fresco:fresco:1.1.0'

compile 'com.github.bumptech.glide:glide:3.6.1'

compile 'commit451:PhotoView:1.2.4'

compile 'com.isseiaoki:simplecropview:1.0.13'

compile &#hun.imageselector:1.1.0'

compile &#java2:rxandroid:2.0.1'

compile &#java2:rxjava:2.0.7'

compile 'fit:retrofit2-rxjava2-adapter:1.0.0'

// compile 'com.android.support:multidex:1.0.1'

}

//apply plugin: 'lambda'

完整proguard-rules.pro

proguard-rules.pro中实体类model要避免混淆

# Add project specific ProGuard rules here.

# By default, the flags in this file are appended to flags specified

# in W:AndroidSDKNew/tools/

# You can edit the include path and order by changing the proguardFiles

# directive adle.

#

# For more details, see

# .html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following

# and specify the fully qualified class name to the JavaScript interface

# class:

#-keepclassmembers class fqcn.of.javascript.interface.for.webview {

# public *;

#}

-keep class !com.jsptpd.** {*;}

-keep class com.del.** {*;}

-keep class com.jsptpd.workformcommon.Model.** {*;}

-keep class com.stapi.ResponseObj {*;}

-keep class com.stapi.Error {*;}

-keep class com.jsptpd.srfa.view.widget.LayerControl.Model.** {*;} #图层功能混淆

-keepclasseswithmembers class * {

@retrofit2.http.* ;

}

-keepattributes Signature

-keepattributes Exceptions

-keepclassmembers class * obot.dao.AbstractDao {

public static java.lang.String TABLENAME;

}

-keep class **$Properties

-dontwarn com.pgyersdk.**

-keep class com.pgyersdk.** { *; }

-dontwarn **

# Retrofit

-keep class retrofit2.** { *; }

-dontwarn retrofit2.**

-keepattributes Signature

-keepattributes Exceptions

-dontwarn okio.**

-dontwarn javax.annotation.**

# RxJava RxAndroid

-dontwarn sun.misc.**

-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {

long producerIndex;

long consumerIndex;

}

-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {

rx.internal.util.atomic.LinkedQueueNode producerNode;

}

-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {

rx.internal.util.atomic.LinkedQueueNode consumerNode;

}

-dontnote rx.internal.util.PlatformDependent

见项目智慧查勘/通用查勘 E:ASProjectnewapp引入了下面两个项目的aar

E:ASProject10trunkCommonReportPage

E:ASProject10trunkmaputil

本文发布于:2024-02-02 23:55:19,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170688931947304.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:代码   android   aar
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23