Skip to content

Commit b23c8a4

Browse files
committed
fix android
1 parent 36d0bf0 commit b23c8a4

File tree

10 files changed

+158
-29
lines changed

10 files changed

+158
-29
lines changed

Android-WebView-JavaScript/.idea/codeStyles/Project.xml

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Android-WebView-JavaScript/.idea/gradle.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Android-WebView-JavaScript/.idea/misc.xml

Lines changed: 18 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Android-WebView-JavaScript/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Android-WebView-JavaScript/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 25
4+
compileSdkVersion 28
55
buildToolsVersion "25.0.2"
66
defaultConfig {
77
applicationId "org.skyfox.android_webview_javascript"
88
minSdkVersion 15
9-
targetSdkVersion 25
9+
targetSdkVersion 28
1010
versionCode 1
1111
versionName "1.0"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -24,7 +24,7 @@ dependencies {
2424
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
2525
exclude group: 'com.android.support', module: 'support-annotations'
2626
})
27-
compile 'com.android.support:appcompat-v7:25.2.0'
27+
compile 'com.android.support:appcompat-v7:28.0.0'
2828
compile 'com.android.support.constraint:constraint-layout:1.0.2'
2929
testCompile 'junit:junit:4.12'
3030
}

Android-WebView-JavaScript/app/src/main/assets/JSWebView.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
window.webkit.messageHandlers[handlerInterface].postMessage(dic);
1616
}else{
1717
//安卓传输不了js json对象
18-
window[handlerInterface][handlerMethod](JSON.stringify(dic));
18+
window[handlerInterface][handlerMethod](parameters);
1919
}
2020
}
2121
function callMobileNative(handlerInterface,handlerMethod,parameters){
@@ -32,9 +32,8 @@
3232
<br>
3333

3434
<input type="button" value="打个招呼" onclick="callMobile('Native','alert',{'message':'你好么'})" />
35-
36-
37-
38-
35+
36+
37+
3938
</body>
4039
</html>

Android-WebView-JavaScript/app/src/main/java/org/skyfox/android_webview_javascript/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected void onCreate(Bundle savedInstanceState) {
3737
}
3838
@JavascriptInterface
3939
public void alert(String param){
40-
Log.i("A",param.toString());
40+
Log.i("alert",param.toString());
4141

4242

4343
}

Android-WebView-JavaScript/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
buildscript {
44
repositories {
55
jcenter()
6+
google()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.1'
9+
classpath 'com.android.tools.build:gradle:3.5.0'
910

1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
@@ -15,6 +16,7 @@ buildscript {
1516
allprojects {
1617
repositories {
1718
jcenter()
19+
google()
1820
}
1921
}
2022

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Jul 04 13:49:24 CST 2017
1+
#Fri Jan 03 20:13:10 CST 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

iOS-WebView-JavaScript/WKWebView/JSWKWebView.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
window.webkit.messageHandlers[handlerInterface].postMessage(dic);
1616
}else{
1717
//安卓传输不了js json对象
18-
window[handlerInterface][handlerMethod](JSON.stringify(dic));
18+
window[handlerInterface][handlerMethod](JSON.stringify(parameters));
1919
}
2020
}
2121
function callMobileNative(handlerInterface,handlerMethod,parameters){

0 commit comments

Comments
 (0)