简体   繁体   English

如何保留Android的3rd Party库?

[英]How to keep 3rd party library for Android?

I have third party libraries in my project. 我的项目中有第三方库。 I added Proguard my project and i make release project but my third party libraries crashes. 我添加了Proguard项目并制作了发布项目,但是第三方库崩溃了。

How to keep third party libraries? 如何保留第三方图书馆?

-keep class com.ice.restring.** { *; } // dont work

a library I used as an example; 我用作示例的库; https://github.com/hamidness/restring/tree/master/restring https://github.com/hamidness/restring/tree/master/restring

preserve all public API 保留所有公共API

-keep public class 3rd_party_lib_name.** {
public *;}

preserve public classes, but not necessarily their fields or methods 保留公共类,但不一定保留其字段或方法

-keep public class 3rd_party_lib_name.**

The third party library is something the supportive unctional library which is developed by some other people or organization other than the android. 第三方库是由android以外的其他人或组织开发的支持性功能库。

Many third party libraries are available in the web for different-different functionalities and features. Web上有许多第三方库,它们具有不同的功能和特性。

For example if you are dealing with image loading and showing in to a ImageView, you can use Piccaso library or glide library. 例如,如果要处理图像加载并显示在ImageView中,则可以使用Piccaso库或glide库。

As according to your need, you can use different-different third party libraries in your app. 根据您的需要,您可以在应用程序中使用不同的第三方库。

In Android Studio, its very simple to add any library. 在Android Studio中,添加任何库非常简单。 Just you need to add the third party library dependency to your android project's application level gradle and sync. 只需要将第三方库依赖项添加到android项目的应用程序级别gradle和sync中即可。 Android Studio will automatically download that library and add to your android project. Android Studio将自动下载该库并将其添加到您的android项目中。 Now you need to go through the api doc of that third party library and you are ready to use in your project. 现在,您需要遍历该第三方库的api文档,并准备在项目中使用它。

You can add third party libraries in build.gradle(Module:app) 您可以在build.gradle(Module:app)中添加第三方库

in build.gradle under android { 在android {

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM