Browse Source

打包签名与appid配置方案

master
xuqm 1 year ago
parent
commit
33b24ed248
8 changed files with 74 additions and 17 deletions
  1. +21
    -3
      app/build.gradle
  2. +14
    -2
      config.gradle
  3. BIN
      keystores/wsecx.keystore
  4. +22
    -11
      push/build.gradle
  5. BIN
      push/libs/MiPush_SDK_Client_5_3_0-C_3rd.aar
  6. +2
    -0
      push/src/main/AndroidManifest.xml
  7. +14
    -0
      push/src/main/java/cn/org/bjca/trust/push/provider/PushProvider.kt
  8. +1
    -1
      settings.gradle

+ 21
- 3
app/build.gradle View File

@@ -15,10 +15,29 @@ android {
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

manifestPlaceholders = [
XIAOMI_APP_ID : "2882303761520224743",
XIAOMI_APP_KEY : "5762022470743",
]
}


signingConfigs {
debug {
storeFile file(signing.storeFile)
storePassword signing.storePassword
keyAlias signing.keyAlias
keyPassword signing.keyPassword
}
}

buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.debug
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
@@ -31,7 +50,6 @@ android {
jvmTarget = '1.8'
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
@@ -42,6 +60,6 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation 'cn.org.bjca.trus:push:0.0.1.011'
// implementation project(path: ':push')
// implementation 'cn.org.bjca.trus:push:0.0.1.011'
implementation project(path: ':push')
}

+ 14
- 2
config.gradle View File

@@ -1,6 +1,18 @@
ext {
maven = [
mavenXuqm = [
mavenUrl: 'http://127.0.0.1:1022/repository/maven-releases/',
username: 'admin',
password : '1234qwer',
password: '1234qwer',
]
mavenSzyx = [
mavenUrl: 'https://nexus.51trust.net/repository/android-hosted/',
username: 'deployment',
password: 'deployment123',
]
signing = [
storeFile: '../keystores/wsecx.keystore',
storePassword: 'bjca123456',
keyAlias: 'bjcawsecx',
keyPassword: 'bjca123456',
]
}

BIN
keystores/wsecx.keystore View File


+ 22
- 11
push/build.gradle View File

@@ -7,8 +7,6 @@ plugins {

def versionCode = 1
def versionName = "0.0.1.011"
def mavenUrl = "http://127.0.0.1:1022/repository/maven-releases/"
def mavenUrlN = "https://nexus.51trust.net/repository/android-hosted/"

android {
namespace 'cn.org.bjca.trust.push'
@@ -50,10 +48,20 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
}

}
repositories{
flatDir {
dirs 'libs'
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {

implementation fileTree(dir: 'libs',includes: ['*.jar','*.aar'])
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
@@ -66,6 +74,9 @@ dependencies {
kapt("androidx.room:room-compiler:2.5.0")
// implementation("androidx.room:room-ktx:2.5.0")

// 小米推送
// implementation (name: 'MiPush_SDK_Client_5_3_0-C_3rd', ext: 'aar')

}

// 这个是把源码打入aar包中的任务
@@ -87,7 +98,7 @@ afterEvaluate {
// 这里除了有debug 还有release
from components.release
// 运行任务,把源码打进去
// artifact sourceJar
artifact sourceJar
}
}
// 添加仓库地址
@@ -95,19 +106,19 @@ afterEvaluate {
maven {
allowInsecureProtocol(true)
name = "xuqm"
url = mavenUrl
url = mavenXuqm.mavenUrl
credentials {
username(maven.username)
password(maven.password)
username(mavenXuqm.username)
password(mavenXuqm.password)
}
}
maven {
allowInsecureProtocol(true)
name = "szyx"
url = mavenUrlN
url = mavenSzyx.mavenUrl
credentials {
username("deployment")
password("deployment123")
username(mavenSzyx.username)
password(mavenSzyx.password)
}
}
}


BIN
push/libs/MiPush_SDK_Client_5_3_0-C_3rd.aar View File


+ 2
- 0
push/src/main/AndroidManifest.xml View File

@@ -6,5 +6,7 @@
android:name=".provider.PushProvider"
android:authorities="${applicationId}.szyx.push"
android:exported="false" />
<meta-data android:name="XIAOMI_APP_ID" android:value="_${XIAOMI_APP_ID}"/>
<meta-data android:name="XIAOMI_APP_KEY" android:value="${XIAOMI_APP_KEY}"/>
</application>
</manifest>

+ 14
- 0
push/src/main/java/cn/org/bjca/trust/push/provider/PushProvider.kt View File

@@ -3,6 +3,7 @@ package cn.org.bjca.trust.push.provider
import android.content.ContentProvider
import android.content.ContentValues
import android.content.UriMatcher
import android.content.pm.PackageManager
import android.database.Cursor
import android.net.Uri
import androidx.sqlite.db.SupportSQLiteQueryBuilder
@@ -11,6 +12,8 @@ import cn.org.bjca.trust.push.common.CommonHelper
import cn.org.bjca.trust.push.common.LogHelper
import cn.org.bjca.trust.push.db.DbHelper
import cn.org.bjca.trust.push.db.device.Device
import com.xiaomi.push.it


class PushProvider : ContentProvider() {

@@ -31,6 +34,17 @@ class PushProvider : ContentProvider() {
CrashHandler.init()
// 初始化唯一码
initDevice()

val manifestField = context!!.packageManager.getApplicationInfo(
context!!.packageName,
PackageManager.GET_META_DATA
).metaData.getString("XIAOMI_APP_ID")

LogHelper.e("====>${manifestField}")


// MiPushClient.registerPush(this, APP_ID, APP_KEY);

return true
}



+ 1
- 1
settings.gradle View File

@@ -11,7 +11,7 @@ pluginManagement {
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
maven {
url 'http://127.0.0.1:1022/repository/maven-public/'


Loading…
Cancel
Save