Skip to content

Commit

Permalink
升级gradle版本,迁移至androidx版本
Browse files Browse the repository at this point in the history
  • Loading branch information
xuexiangjys committed Oct 25, 2020
1 parent dcb0cfd commit c28d31e
Show file tree
Hide file tree
Showing 38 changed files with 392 additions and 398 deletions.
22 changes: 0 additions & 22 deletions .idea/gradle.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/markdown-navigator/profiles_settings.xml

This file was deleted.

33 changes: 0 additions & 33 deletions .idea/misc.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
targetSdkVersion build_versions.target_sdk
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -44,11 +44,11 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation deps.support.app_compat
// implementation project(':xaop-runtime')
implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.5'
implementation deps.androidx.appcompat
implementation project(':xaop-runtime')
// implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.5'

implementation 'com.github.xuexiangjys.XUtil:xutil-core:1.1.6'
implementation 'com.github.xuexiangjys.XUtil:xutil-core:1.1.8'
implementation deps.gson

}
6 changes: 5 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.flash" />

<!--定位权限-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:name=".App"
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down
10 changes: 2 additions & 8 deletions app/src/main/java/com/xuexiang/xaopdemo/GsonDiskConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ public <T> T load(InputStream source, Type type) {
mGson = new Gson();
}
value = mGson.fromJson(new InputStreamReader(source), type);
} catch (JsonIOException e) {
XLogger.e(e);
} catch (JsonSyntaxException e) {
} catch (JsonIOException | JsonSyntaxException e) {
XLogger.e(e);
} finally {
Utils.closeIO(source);
Expand All @@ -71,11 +69,7 @@ public boolean writer(OutputStream sink, Object data) {
sink.write(bytes, 0, bytes.length);
sink.flush();
return true;
} catch (JsonIOException e) {
XLogger.e(e);
} catch (JsonSyntaxException e) {
XLogger.e(e);
} catch (IOException e) {
} catch (JsonIOException | JsonSyntaxException | IOException e) {
XLogger.e(e);
} finally {
Utils.closeIO(sink);
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/xuexiang/xaopdemo/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
package com.xuexiang.xaopdemo;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.xuexiang.xaop.annotation.SingleClick;
import com.xuexiang.xutil.tip.ToastUtils;

Expand Down
15 changes: 11 additions & 4 deletions app/src/main/java/com/xuexiang/xaopdemo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
package com.xuexiang.xaopdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.xuexiang.xaop.annotation.DebugLog;
import com.xuexiang.xaop.annotation.DiskCache;
import com.xuexiang.xaop.annotation.IOThread;
Expand All @@ -31,7 +32,6 @@
import com.xuexiang.xaop.annotation.Permission;
import com.xuexiang.xaop.annotation.Safe;
import com.xuexiang.xaop.annotation.SingleClick;
import com.xuexiang.xaop.cache.XCache;
import com.xuexiang.xaop.cache.XDiskCache;
import com.xuexiang.xaop.cache.XMemoryCache;
import com.xuexiang.xaop.consts.PermissionConsts;
Expand All @@ -47,6 +47,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe

TextView mTvHello;

int count = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -81,7 +83,7 @@ public void run() {
case R.id.btn_disk_cache:
Log.e("xuexiang", "@DiskCache getDiskCacheLoginInfo:" + getDiskCacheLoginInfo());
// testDiskCache1();
// testDiskCache2();
// XLogger.e("testDiskCache2:" + testDiskCache2());
// testDiskCache3();
// testDiskCache4((int) (Math.random() * 100), "1234");
// testDiskCache5();
Expand Down Expand Up @@ -164,7 +166,12 @@ private int testDiskCache1() {

@DiskCache
private String testDiskCache2() {
return "123";
count ++;
if (count % 3 == 0) {
return "123";
} else {
return "";
}
}

@DiskCache
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v4.widget.NestedScrollView
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down Expand Up @@ -107,6 +107,6 @@
</LinearLayout>


</android.support.v4.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>

</LinearLayout>
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.31'
ext.kotlin_version = '1.3.72'

apply from: './versions.gradle'
addRepos(repositories) //增加代码仓库
Expand All @@ -32,7 +32,7 @@ buildscript {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4'
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'
}
repositories {
google()
Expand Down
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# 表示主工程使用AndroidX形式
android.useAndroidX=true
# 表示针对主工程中使用到的三方库,也会自动执行AndroidX的替换过程。
android.enableJetifier=true

android.enableD8=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
19 changes: 13 additions & 6 deletions kotlin-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'android-aspectjx'
apply plugin: 'com.xuexiang.xaop'
apply plugin: 'android-aspectjx'

android {
compileSdkVersion build_versions.target_sdk
Expand All @@ -32,8 +32,7 @@ android {
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
Expand All @@ -43,15 +42,23 @@ android {
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

aspectjx {
include 'com.xuexiang.kotlintest'
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation deps.support.app_compat
implementation deps.androidx.appcompat

implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.1'
implementation 'com.github.xuexiangjys.XUtil:xutil-core:1.1.5'
implementation project(':xaop-runtime')
implementation 'com.github.xuexiangjys.XUtil:xutil-core:1.1.8'

}
21 changes: 20 additions & 1 deletion kotlin-test/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,28 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xuexiang.kotlintest">

<!--手机权限-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<!--闪光灯-->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.flash" />

<!--定位权限-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:name=".App"
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package com.xuexiang.kotlintest

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.xuexiang.xaop.annotation.DebugLog
import com.xuexiang.xaop.annotation.DiskCache
import com.xuexiang.xaop.annotation.IOThread
Expand Down
Loading

0 comments on commit c28d31e

Please sign in to comment.