试图调用WebView时,在调用本地网页时会出现错误
Uncaught :对象“某些对象”没有方法:‘包括’,源:TypeError
它会给Kitkat和下面的人带来错误。它在Kitkat上方正常工作。
它在下面的分级设置中运行得很好
compileSdkVersion 25
buildToolsVersion "25.0.2"和坚毅
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1目前正在使用分级设置。
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v13:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'发布于 2017-10-30 06:24:44
之所以会出现这种情况,是因为您在js文件中的字符串上使用了includes方法,在最新的JavaScript版本ECMAScript 6和android中都不支持这个版本。
您需要使用indexOf而不是includes
var str = "Hello world, welcome to the universe.";
var n = str.includes("world");
# Replace above line of code and use indexOf.
var n = str.indexOf("world") > -1;https://stackoverflow.com/questions/47008921
复制相似问题