关于SweetAlertDialog在AS3.0环境下报错的处理.

SweetAlertDialog Android Studio3.0, Gradle4.1报错处理

前言

之前常用这个轮子, 近两年, 原作者不再维护, AS3.0引用报错, 在此声明新版使用方式.

方式一

通过我自己封装SweetAlertDialog添加依赖,直接引用

参考项目地址:https://github.com/Cazaea/SweetAlertDialog

方式二

通过导入Library引用

1.下载作者源码https://github.com/pedant/sweet-alert-dialog,将作者源码中library作为module引用;
通过file–>new–>import Module(将作者源码中library直接导入)

参考: 为项目添加Module依赖

2.删除作者library–>build.gradle中给定的VERSION_NAME, GROUP,以及apply from引用, 更改版本信息(所有xxVersion值)与你的主包xxVersion值统一

apply plugin: 'com.android.library'
//version = VERSION_NAME
//group = GROUP 
    android {
        compileSdkVersion 26
        buildToolsVersion '26.0.2'

        defaultConfig {
            minSdkVersion 19
        }

        lintOptions {
            abortOnError false
        }
    }

    dependencies {
        implementation 'com.pnikosis:materialish-progress:1.0'
    }

//apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'

3.同上, 修改library–>src–>AndroidManifest文件中 xxVersion值与主包下值统一

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="cn.pedant.SweetAlert">

    <application />

</manifest>

4.顺便贴出主包信息, 仅供参考.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "cn.pedant.SweetAlert.sample"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        multiDexEnabled true
        ndk {
            abiFilters "armeabi"
        }
    }

    lintOptions {
        abortOnError false
    }

    /*最新打包输出命名方式 com.xx.xx-versionName(versionCode).apk*/
    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            def newApkName = applicationId + "-" + variant.versionName + "(" + variant.versionCode + ")" + ".apk"
            outputFileName = new File(newApkName)
        }
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    //compile 'cn.pedant.sweetalert:library:1.3'
    implementation project(':library')
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

五道口老炮儿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值