Skip to content

Commit

Permalink
兼容最新打包
Browse files Browse the repository at this point in the history
  • Loading branch information
kymjs committed Apr 6, 2022
1 parent c9a22b8 commit 76f7b5b
Show file tree
Hide file tree
Showing 12 changed files with 187 additions and 133 deletions.
21 changes: 10 additions & 11 deletions Faraday/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
maven { url 'https://jitpack.io' }
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.android.tools.build:gradle:4.1.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}

allprojects {
repositories {
maven { url 'https://jitpack.io' }
google()
mavenCentral()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
}
33 changes: 19 additions & 14 deletions Faraday/faraday/build.gradle
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

group = 'com.github.kymjs'
version = "2.0.0"

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 30

defaultConfig {
minSdkVersion 14
targetSdkVersion 25
targetSdkVersion 30
versionCode 1
versionName "1.0"

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

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.kymjs.core:common:1.0.10'
compile 'com.google.code.gson:gson:2.8.0'
implementation 'com.github.kymjs:common:2.0.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
}

apply plugin: 'maven-publish'
apply plugin: 'com.github.dcendents.android-maven'

This file was deleted.

This file was deleted.

14 changes: 9 additions & 5 deletions Faraday/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# 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

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# 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
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
4 changes: 2 additions & 2 deletions Faraday/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Tue Jun 22 08:02:06 CST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
24 changes: 13 additions & 11 deletions Faraday/sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 30

defaultConfig {
applicationId "com.kymjs.faradayapp"
minSdkVersion 14
targetSdkVersion 25
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
compile project(':faraday')
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation project(':faraday')
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.JsPromptResult;
import android.webkit.WebChromeClient;
import android.webkit.WebView;

import androidx.appcompat.app.AppCompatActivity;

import com.kymjs.faraday.FaradayBridge;
import com.kymjs.faraday.jssdk.view.ViewDialog;

Expand Down

This file was deleted.

59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,61 @@
## Faraday: Android hybrid framework
[![OSL](https://kymjs.com/qiniu/image/logo3.png)](https://kymjs.com/works/)
=================


## Faraday

A set of perfect H5 hybrid jsbridge solution of Android, which is simple and convenient for development and debugging

* Compatible with Android 12

* Support androidx package

* No privacy related issues

## Getting Started

latest version numbers: [![](https://jitpack.io/v/kymjs/Faraday.svg)](https://jitpack.io/#kymjs/Faraday)

```
// root build.gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
// module build.gradle
dependencies {
implementation 'com.github.kymjs:faraday:2.0.0'
}
```

#### register JSBridge

```
FaradayBridge.getInstance().register(new DemoBridge());
```

#### customs WebView

```
public class InjectedChromeClient extends WebChromeClient {
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
// 只需要在 onJsPrompt 方法中通知Faraday即可
result.confirm(FaradayBridge.getInstance().call(view, message));
return true;
}
}
```

#### native call js

使用简单,且方便自定义封装,对 H5 侧开发更直观

```
webview.loadUrl("javascript://window.hello()");
```



Expand Down
Loading

0 comments on commit 76f7b5b

Please sign in to comment.