SweetAlertDialog使用方法和遇到的問題

github:Sweet Alert Dialog


提示!可以先看看這篇:傳送

本文參考了https://blog.csdn.net/qq_15037349/article/details/78480218

一、下載lib包

ps:由於使用complie不成功所以就直接下載的lib

//compile 'cn.pedant.sweetalert:library:1.3'

相關錯誤:

java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:null

通過importmodule引入到項目

二、配置gradle

1.配置library下的build.gradle


2.到app的build.gradle中加上:
compile project(':library')


3.加入混淆

-keep class cn.pedant.SweetAlert.Rotate3dAnimation {
  public <init>(...);
}


4.gradle.properties文件中

VERSION_NAME=1.3
VERSION_CODE=4
GROUP=cn.pedant.sweetalert

POM_DESCRIPTION=SweetAlert for Android, a beautiful and clever alert dialog.
POM_URL=https://github.com/pedant/sweet-alert-dialog
POM_SCM_URL=https://github.com/pedant/sweet-alert-dialog
POM_SCM_CONNECTION=scm:[email protected]:pedant/sweet-alert-dialog.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:pedant/sweet-alert-dialog.git
POM_LICENCE_NAME=The MIT License
POM_LICENCE_URL=http://opensource.org/licenses/MIT
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=pedant
POM_DEVELOPER_NAME=Pedant

相關問題:

Could not get unknown property 'VERSION_NAME' for project 'SweettalertLibrary' of type 


5.配置manifest

tools:replace="android:icon, android:theme"

相關錯誤:

Error:Execution failed for task ':app:processDebugManifest'.
            > Manifest merger failed : Attribute application@icon value=(@mipmap/logo) from AndroidManifest.xml:44:9-36
    is also present at [com.pnikosis:materialish-progress:1.0] AndroidManifest.xml:32:9-45 value=(@drawable/ic_launcher).
    Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:41:5-223:19 to override.



三、使用

new SweetAlertDialog(context)
                        .setTitleText("作者信息")
                        .setContentText("黑盒子:歡迎使用!如有bug,歡迎反饋")
                        .show();


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章