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();


猜你喜欢

转载自blog.csdn.net/blank__box/article/details/80321473