提交 4367d93e authored 作者: 刘建胜's avatar 刘建胜

为了兼容 android support 库 版本从androidX降级

上级 037b5d4b
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
...@@ -41,15 +41,15 @@ android { ...@@ -41,15 +41,15 @@ android {
dependencies { dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation project(path: ':appUpdate') implementation project(path: ':appUpdate')
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//https://github.com/WVector/AppUpdate/blob/master/java.md //https://github.com/WVector/AppUpdate/blob/master/java.md
implementation 'com.qianwen:update-app:3.5.2' // implementation 'com.qianwen:update-app:3.5.2'
...@@ -64,5 +64,5 @@ dependencies { ...@@ -64,5 +64,5 @@ dependencies {
//rxjava2 (RxJava2/Rxjava3二选一,使用asXxx方法时必须) //rxjava2 (RxJava2/Rxjava3二选一,使用asXxx方法时必须)
implementation 'io.reactivex.rxjava2:rxjava:2.2.8' implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.ljx.rxlife2:rxlife-rxjava:2.0.0' //管理RxJava2生命周期,页面销毁,关 implementation 'com.rxjava.rxlife:rxlife:1.1.0'
} }
\ No newline at end of file
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"properties": [], "properties": [],
"versionCode": 2, "versionCode": 1,
"versionName": "2.0", "versionName": "1.0",
"enabled": true, "enabled": true,
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.liujson.appupdatedemo"> package="cn.liujson.appupdatedemo"
xmlns:dist="http://schemas.android.com/apk/distribution">
<dist:module dist:instant="true" />
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<application <application
android:allowBackup="true" android:allowBackup="true"
......
...@@ -4,11 +4,14 @@ import android.app.AlertDialog; ...@@ -4,11 +4,14 @@ import android.app.AlertDialog;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.TaskStackBuilder; import android.app.TaskStackBuilder;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -19,10 +22,6 @@ import android.widget.ProgressBar; ...@@ -19,10 +22,6 @@ import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.rxjava.rxlife.RxLife; import com.rxjava.rxlife.RxLife;
......
...@@ -3,10 +3,10 @@ package cn.liujson.appupdatedemo; ...@@ -3,10 +3,10 @@ package cn.liujson.appupdatedemo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import java.io.File; import java.io.File;
...@@ -16,7 +16,6 @@ import java.io.File; ...@@ -16,7 +16,6 @@ import java.io.File;
*/ */
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -25,7 +24,9 @@ public class MainActivity extends AppCompatActivity { ...@@ -25,7 +24,9 @@ public class MainActivity extends AppCompatActivity {
if (supportActionBar != null) { if (supportActionBar != null) {
supportActionBar.hide(); supportActionBar.hide();
} }
getSupportFragmentManager().beginTransaction()
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fl_container, AppUpdateFragment.newInstance("http://192.168.1.181:8090/static/app/apk_update_info.json", .replace(R.id.fl_container, AppUpdateFragment.newInstance("http://192.168.1.181:8090/static/app/apk_update_info.json",
new File(Environment.getExternalStorageDirectory(), "/test/testUpdate.apk").getAbsolutePath())) new File(Environment.getExternalStorageDirectory(), "/test/testUpdate.apk").getAbsolutePath()))
.commit(); .commit();
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -19,4 +19,4 @@ ...@@ -19,4 +19,4 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.022" /> app:layout_constraintVertical_bias="0.022" />
</androidx.constraintlayout.widget.ConstraintLayout> </android.support.constraint.ConstraintLayout>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -49,5 +49,4 @@ ...@@ -49,5 +49,4 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/m_progress_bar" /> app:layout_constraintTop_toBottomOf="@+id/m_progress_bar" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
\ No newline at end of file
...@@ -41,7 +41,8 @@ android { ...@@ -41,7 +41,8 @@ android {
dependencies { dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
...@@ -57,5 +58,5 @@ dependencies { ...@@ -57,5 +58,5 @@ dependencies {
//rxjava2 (RxJava2/Rxjava3二选一,使用asXxx方法时必须) //rxjava2 (RxJava2/Rxjava3二选一,使用asXxx方法时必须)
implementation 'io.reactivex.rxjava2:rxjava:2.2.8' implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.ljx.rxlife2:rxlife-rxjava:2.0.0' //管理RxJava2生命周期,页面销毁,关 implementation 'com.rxjava.rxlife:rxlife:1.1.0'
} }
\ No newline at end of file
...@@ -15,14 +15,12 @@ import android.net.Uri; ...@@ -15,14 +15,12 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.IBinder; import android.os.IBinder;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresPermission;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RequiresPermission;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
......
...@@ -9,9 +9,9 @@ import android.content.ServiceConnection; ...@@ -9,9 +9,9 @@ import android.content.ServiceConnection;
import android.os.Binder; import android.os.Binder;
import android.os.Build; import android.os.Build;
import android.os.IBinder; import android.os.IBinder;
import android.support.annotation.Nullable;
import android.support.v4.app.NotificationCompat;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
......
...@@ -16,4 +16,4 @@ org.gradle.jvmargs=-Xmx2048m ...@@ -16,4 +16,4 @@ org.gradle.jvmargs=-Xmx2048m
# https://developer.android.com/topic/libraries/support-library/androidx-rn # https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX # Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true #android.enableJetifier=true
\ No newline at end of file \ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论