diff --git a/build.gradle b/build.gradle index ba213bd..21dbf66 100644 --- a/build.gradle +++ b/build.gradle @@ -9,10 +9,9 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' -// classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' -// classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' -// classpath 'me.tatarka:gradle-retrolambda:3.2.5' + classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/library/build.gradle b/library/build.gradle index 19c5a68..9a2557a 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,4 +1,7 @@ apply plugin: 'com.android.library' +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' +version = "2.2.2" android { compileSdkVersion 28 buildToolsVersion "28.0.3" @@ -24,8 +27,83 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'com.squareup.okhttp3:okhttp:3.14.2' + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.squareup.okhttp3:okhttp:3.8.1' implementation 'org.greenrobot:eventbus:3.1.1' } +def siteUrl = 'https://github.com/AlexLiuSheng/CheckVersionLib' // 项目的主页 +def gitUrl = 'https://github.com/AlexLiuSheng/CheckVersionLib.git' // Git仓库的url +group = "com.allenliu.versionchecklib" // Maven Group ID for the artifact,一般填你唯一的包名 +install { + repositories.mavenInstaller { + // This generates POM.xml with proper parameters + pom { + project { + packaging 'aar' + // Add your description here + name 'a library that can auto check version on android ' //项目描述 + url siteUrl + // Set your license + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id 'liusheng' //填写的一些基本信息 + name 'AllenLiu' + email '29949821@qq.com' + } + } + scm { + connection gitUrl + developerConnection gitUrl + url siteUrl + } + } + } + } +} + + +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} +task javadoc(type: Javadoc) { + options.encoding = "UTF-8" + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} +artifacts { + archives javadocJar + archives sourcesJar +} +Properties properties = new Properties() +properties.load(project.rootProject.file('local.properties').newDataInputStream()) +bintray { + user = properties.getProperty("bintray.user") + key = properties.getProperty("bintray.apiKey") + configurations = ['archives'] + pkg { + repo = "maven" + name = "VersionCheckLib" //发布到JCenter上的项目名字 + websiteUrl = siteUrl + vcsUrl = gitUrl + licenses = ["Apache-2.0"] + publish = true + } +} +tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + options.addStringOption('encoding', 'UTF-8') + options.addStringOption('charSet', 'UTF-8') +} + diff --git a/library/src/main/java/com/allenliu/versionchecklib/core/DownloadManager.java b/library/src/main/java/com/allenliu/versionchecklib/core/DownloadManager.java index 77c4f11..bc92e6e 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/core/DownloadManager.java +++ b/library/src/main/java/com/allenliu/versionchecklib/core/DownloadManager.java @@ -13,7 +13,8 @@ import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; -import androidx.core.app.NotificationCompat; +import android.support.v4.app.NotificationCompat; + import com.allenliu.versionchecklib.R; import com.allenliu.versionchecklib.callback.DownloadListener; diff --git a/library/src/main/java/com/allenliu/versionchecklib/core/PermissionDialogActivity.java b/library/src/main/java/com/allenliu/versionchecklib/core/PermissionDialogActivity.java index feafe12..0fb3f8a 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/core/PermissionDialogActivity.java +++ b/library/src/main/java/com/allenliu/versionchecklib/core/PermissionDialogActivity.java @@ -4,9 +4,9 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; -import androidx.core.app.ActivityCompat; -import androidx.core.content.ContextCompat; -import androidx.appcompat.app.AppCompatActivity; + +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; import android.widget.Toast; import com.allenliu.versionchecklib.R; diff --git a/library/src/main/java/com/allenliu/versionchecklib/core/VersionDialogActivity.java b/library/src/main/java/com/allenliu/versionchecklib/core/VersionDialogActivity.java index cfe6ed6..a563c53 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/core/VersionDialogActivity.java +++ b/library/src/main/java/com/allenliu/versionchecklib/core/VersionDialogActivity.java @@ -6,9 +6,10 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; -import androidx.core.app.ActivityCompat; -import androidx.core.content.ContextCompat; -import androidx.appcompat.app.AlertDialog; + +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; +import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.LayoutInflater; import android.view.View; diff --git a/library/src/main/java/com/allenliu/versionchecklib/core/VersionFileProvider.java b/library/src/main/java/com/allenliu/versionchecklib/core/VersionFileProvider.java index 1c50ab0..6c67935 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/core/VersionFileProvider.java +++ b/library/src/main/java/com/allenliu/versionchecklib/core/VersionFileProvider.java @@ -1,6 +1,7 @@ package com.allenliu.versionchecklib.core; -import androidx.core.content.FileProvider; + +import android.support.v4.content.FileProvider; /** * Created by Allen Liu on 2017/2/28. diff --git a/library/src/main/java/com/allenliu/versionchecklib/v2/AllenVersionChecker.java b/library/src/main/java/com/allenliu/versionchecklib/v2/AllenVersionChecker.java index 66ae065..cb4b55b 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/v2/AllenVersionChecker.java +++ b/library/src/main/java/com/allenliu/versionchecklib/v2/AllenVersionChecker.java @@ -1,8 +1,8 @@ package com.allenliu.versionchecklib.v2; import android.content.Context; +import android.support.annotation.Nullable; -import androidx.annotation.Nullable; import com.allenliu.versionchecklib.core.http.AllenHttp; import com.allenliu.versionchecklib.utils.AllenEventBusUtil; diff --git a/library/src/main/java/com/allenliu/versionchecklib/v2/builder/DownloadBuilder.java b/library/src/main/java/com/allenliu/versionchecklib/v2/builder/DownloadBuilder.java index 873105f..e0d60f2 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/v2/builder/DownloadBuilder.java +++ b/library/src/main/java/com/allenliu/versionchecklib/v2/builder/DownloadBuilder.java @@ -3,7 +3,8 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; -import androidx.annotation.NonNull; +import android.support.annotation.NonNull; + import com.allenliu.versionchecklib.callback.APKDownloadListener; import com.allenliu.versionchecklib.callback.CommitClickListener; diff --git a/library/src/main/java/com/allenliu/versionchecklib/v2/callback/RequestVersionListener.java b/library/src/main/java/com/allenliu/versionchecklib/v2/callback/RequestVersionListener.java index bc59d0a..bae218a 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/v2/callback/RequestVersionListener.java +++ b/library/src/main/java/com/allenliu/versionchecklib/v2/callback/RequestVersionListener.java @@ -1,6 +1,6 @@ package com.allenliu.versionchecklib.v2.callback; -import androidx.annotation.Nullable; +import android.support.annotation.Nullable; import com.allenliu.versionchecklib.v2.builder.DownloadBuilder; import com.allenliu.versionchecklib.v2.builder.UIData; diff --git a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/AllenBaseActivity.java b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/AllenBaseActivity.java index eb6f2c4..d157c00 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/AllenBaseActivity.java +++ b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/AllenBaseActivity.java @@ -6,9 +6,8 @@ import android.os.Build; import android.os.Bundle; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; - +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; diff --git a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/DownloadFailedActivity.java b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/DownloadFailedActivity.java index f02f526..b406705 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/DownloadFailedActivity.java +++ b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/DownloadFailedActivity.java @@ -2,9 +2,9 @@ import android.app.Dialog; import android.content.DialogInterface; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; + import android.os.Bundle; +import android.support.v7.app.AlertDialog; import android.view.View; import com.allenliu.versionchecklib.R; diff --git a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/DownloadingActivity.java b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/DownloadingActivity.java index 3d1a19a..2db79f5 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/DownloadingActivity.java +++ b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/DownloadingActivity.java @@ -3,9 +3,9 @@ import android.app.Dialog; import android.content.DialogInterface; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; + import android.os.Bundle; +import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.widget.ProgressBar; diff --git a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/NotificationHelper.java b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/NotificationHelper.java index 9047a31..7322a85 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/NotificationHelper.java +++ b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/NotificationHelper.java @@ -11,9 +11,9 @@ import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; +import android.support.annotation.RequiresApi; +import android.support.v4.app.NotificationCompat; -import androidx.annotation.RequiresApi; -import androidx.core.app.NotificationCompat; import com.allenliu.versionchecklib.R; import com.allenliu.versionchecklib.core.PermissionDialogActivity; diff --git a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/UIActivity.java b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/UIActivity.java index 2c32368..bc11135 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/UIActivity.java +++ b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/UIActivity.java @@ -3,7 +3,8 @@ import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; -import androidx.appcompat.app.AlertDialog; + +import android.support.v7.app.AlertDialog; import android.view.View; import com.allenliu.versionchecklib.R; diff --git a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/VersionService.java b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/VersionService.java index 6d7343d..939bc40 100644 --- a/library/src/main/java/com/allenliu/versionchecklib/v2/ui/VersionService.java +++ b/library/src/main/java/com/allenliu/versionchecklib/v2/ui/VersionService.java @@ -8,10 +8,9 @@ import android.content.ServiceConnection; import android.os.Build; import android.os.IBinder; +import android.support.annotation.Nullable; +import android.support.annotation.WorkerThread; -import androidx.annotation.Nullable; -import androidx.annotation.WorkerThread; -import androidx.core.app.NotificationCompat; import com.allenliu.versionchecklib.R; import com.allenliu.versionchecklib.callback.DownloadListener; diff --git a/settings.gradle b/settings.gradle index 0b07bb6..4ac2fa5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':library', "sample" +include ':library',':sample'