Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

迁移到AndroidX,升级gradle到最新版 #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,30 @@ buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:4.1.1'
}
}

repositories {
mavenCentral()
jcenter()
google()
}

subprojects {
repositories {
mavenCentral()
jcenter()
google()
}

ext {
compileSdkVersion = 25
buildToolsVersion = "25.0.3"
minSdkVersion = 17
targetSdkVersion = 22
supportLibVersion = "25.3.1"
compileSdkVersion = 30
buildToolsVersion = "30.0.0"
minSdkVersion = 21
targetSdkVersion = 30
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要对Android10及Android11的外部存储做兼容处理

}
}
33 changes: 15 additions & 18 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# 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
# ������ߵ��ڴ棬Ĭ��Ϊ: -Xmx1024m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx1536M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# �����
org.gradle.parallel=true
# �����ػ�
org.gradle.daemon=true
org.gradle.configureondemand=true
#��������
org.gradle.configureondemand=true
#����AndroidX
android.useAndroidX=true
#��������Ǩ�Ƶ�AndroidX
android.enableJetifier=true
#��ʾ�������gradle��ջ
android.debug.obsoleteApi=true
#INSTALL_FAILED_TEST_ONLY
android.injected.testOnly=false
2 changes: 1 addition & 1 deletion android/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-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
20 changes: 10 additions & 10 deletions android/hera/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apply plugin: 'com.android.library'

dependencies {
compile 'com.android.support:design:25.3.1'

compile "com.github.bumptech.glide:glide:3.7.0"
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.google.zxing:android-core:3.3.0'
compile 'com.google.zxing:core:3.3.0'

compile 'com.nineoldandroids:library:2.4.0'
compile 'me.iwf.photopicker:PhotoPicker:0.9.5@aar'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
implementation 'com.google.android.material:material:1.2.0'
implementation "com.github.bumptech.glide:glide:3.7.0"
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.google.code.gson:gson:2.8.6'
//noinspection GradleDependency 注意:zxing 3.4.0开始,扫码只支持API>=24,若要支持Android7.0以下则需降级到3.3.3版本
implementation 'com.google.zxing:core:3.3.3'
implementation 'me.iwf.photopicker:PhotoPicker:0.9.5@aar'
}

android {
Expand Down
19 changes: 0 additions & 19 deletions android/hera/gradle.properties

This file was deleted.

1 change: 1 addition & 0 deletions android/hera/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
package com.weidian.lib.hera.api.file;

import android.content.Context;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.text.TextUtils;

import com.weidian.lib.hera.api.AbsModule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.text.TextUtils;
import android.view.Window;
import android.widget.FrameLayout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import android.os.AsyncTask;
import android.os.Build;
import android.os.IBinder;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.text.TextUtils;
import android.webkit.WebView;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import android.content.Context;
import android.graphics.Color;
import android.net.Uri;
import android.support.v4.widget.SwipeRefreshLayout;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
Expand All @@ -43,6 +42,8 @@
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import com.weidian.lib.hera.R;
import com.weidian.lib.hera.config.AppConfig;
import com.weidian.lib.hera.interfaces.IBridgeHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.support.v7.content.res.AppCompatResources;
import android.support.v7.widget.Toolbar;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.Toolbar;

import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
package com.weidian.lib.hera.page.view;

import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.view.ViewParent;

import com.weidian.lib.hera.trace.HeraTrace;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import com.weidian.lib.hera.web.HeraWebView;

public class PageWebView extends HeraWebView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.util.Log;

import com.weidian.lib.hera.main.HeraService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.IntRange;
import androidx.annotation.ColorInt;
import androidx.annotation.IntRange;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import android.graphics.Rect;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import android.content.Context;
import android.os.Handler;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.Gravity;
Expand Down
4 changes: 3 additions & 1 deletion android/sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
apply plugin: 'com.android.application'

dependencies {
compile project(':hera')
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation project(':hera')
}

android {
Expand Down
19 changes: 0 additions & 19 deletions android/sample/gradle.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import androidx.annotation.Nullable;

public class ForResultActivity extends Activity {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.weidian.lib.hera.sample;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.view.View;

import com.weidian.lib.hera.main.HeraService;
Expand Down