``我是Andriod Studio的新手。我正在关注这个https://www.youtube.com/watch?v=Kufnu_q8MwA。我正在使用Android Studio 3.作为本教程的一部分,我创建了两个文件并对mainactivity.java进行了一些修改。该应用程序在我的手机上成功启动。但是当我点击链接打开two.html时,我只能看到索引页面。它显示为"文件不存在。文件必须已重命名,删除或移动"。 公共类MainActivity扩展了AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String myurl="file:///android_asset/index.html";
WebView view=(WebView)this.findViewById(R.id.webView);
view.getSettings().setJavaScriptEnabled(true);
view.loadUrl(myurl);
}
}
Logcat输出
05-31 18:19:12.960 29333-29333/? I/art: Late-enabling -Xcheck:jni
05-31 18:19:13.298 29333-29333/com.example.user.mywebapp I/InstantRun: starting instant run server: is main process
05-31 18:19:13.518 29333-29333/com.example.user.mywebapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
05-31 18:19:13.906 29333-29333/com.example.user.mywebapp I/WebViewFactory: Loading com.google.android.webview version 66.0.3359.158 (code 335915800)
05-31 18:19:13.958 29333-29333/com.example.user.mywebapp I/cr_LibraryLoader: Time to load native libraries: 2 ms (timestamps 3442-3444)
05-31 18:19:14.002 29333-29333/com.example.user.mywebapp I/chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
05-31 18:19:14.007 29333-29333/com.example.user.mywebapp I/cr_LibraryLoader: Expected native library version number "66.0.3359.158", actual native library version number "66.0.3359.158"
05-31 18:19:14.034 29333-29333/com.example.user.mywebapp I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
05-31 18:19:14.036 29333-29333/com.example.user.mywebapp I/cr_base: Android Locale: en_IN requires .pak files: []
05-31 18:19:14.224 29333-29406/com.example.user.mywebapp E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
05-31 18:19:14.230 29333-29399/com.example.user.mywebapp W/cr_media: Requires BLUETOOTH permission
05-31 18:19:14.233 29333-29406/com.example.user.mywebapp I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: (Ib51f183a9b)
OpenGL ES Shader Compiler Version: E031.25.03.02
Build Date: 06/16/16 Thu
Local Branch:
Remote Branch:
Local Patches:
Reconstruct Branch:
05-31 18:19:14.304 29333-29415/com.example.user.mywebapp D/OpenGLRenderer: Render dirty regions requested: true
05-31 18:19:14.320 29333-29333/com.example.user.mywebapp D/Atlas: Validating map...
05-31 18:19:14.394 29333-29406/com.example.user.mywebapp W/AudioCapabilities: Unsupported mime audio/evrc
05-31 18:19:14.395 29333-29406/com.example.user.mywebapp W/AudioCapabilities: Unsupported mime audio/qcelp
05-31 18:19:14.397 29333-29406/com.example.user.mywebapp W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
05-31 18:19:14.407 29333-29406/com.example.user.mywebapp W/AudioCapabilities: Unsupported mime audio/qcelp
05-31 18:19:14.408 29333-29406/com.example.user.mywebapp W/AudioCapabilities: Unsupported mime audio/evrc
05-31 18:19:14.414 29333-29406/com.example.user.mywebapp W/VideoCapabilities: Unsupported mime video/mpeg2
05-31 18:19:14.416 29333-29406/com.example.user.mywebapp W/VideoCapabilities: Unsupported mime video/mpeg2
05-31 18:19:14.424 29333-29406/com.example.user.mywebapp W/Utils: could not parse size range '64x64-1920X1080'
05-31 18:19:14.431 29333-29406/com.example.user.mywebapp W/VideoCapabilities: Unsupported mime video/mp4v-esdp
05-31 18:19:14.445 29333-29406/com.example.user.mywebapp I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
05-31 18:19:14.561 29333-29415/com.example.user.mywebapp I/OpenGLRenderer: Initialized EGL, version 1.4
05-31 18:19:14.566 29333-29415/com.example.user.mywebapp D/OpenGLRenderer: Enabling debug mode 0
05-31 18:19:14.568 29333-29415/com.example.user.mywebapp I/qdutils: PartialUpdate status: Disabled
Left Align: 0
Width Align: 0
Top Align: 0
Height Align: 0
Min ROI Width: 0
Min ROI Height: 0
Needs ROI Merge: 0
Dynamic Fps: Disabled
Min Panel fps: 0
Max Panel fps: 0
05-31 18:19:14.669 29333-29333/com.example.user.mywebapp W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
05-31 18:19:14.684 29333-29404/com.example.user.mywebapp V/NotificationManager: com.example.user.mywebapp: cancel(10436)
05-31 18:19:14.695 29333-29333/com.example.user.mywebapp I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@272c4b48 time:513154182
05-31 18:19:14.700 29333-29422/com.example.user.mywebapp W/cr_CrashFileManager: /data/data/com.example.user.mywebapp/cache/WebView/Crash Reports does not exist or is not a directory
请建议。我是Android Studio的新手。我知道有一个小问题,我无法检测到它。提前谢谢。
index.html
<html>
<head>
<title>Demo</title>
</head>
<body>
<button>
<a href="two.html">
<font size="30">go to second page</font>
</a>
</button>
<center>this is first page</center>
</body>
</html>
two.html
<html>
<head>
<title>Demo</title>
</head>
<body>
<button>
<a href="index.html">
<font size="30">go to index page</font>
</a>
</button>
<center>this is second page</center>
</body>
</html>
&#13;