My Android app stops at opening, but Android studio shows no error. Can somebody help please? I'm trying to convert my website into an android app. I'm a little new at this.
Below is a display of my MainActivity.java
code
package com.example.deedat.webtry2;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
private WebView myWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView = (WebView)findViewById(R.id.webView);
myWebView.loadUrl("http://www.motivationalscholar.com");
myWebView.setWebViewClient(new WebViewClient());
}
@Override
public void onBackPressed() {
if(myWebView.canGoBack()){
myWebView.goBack();
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
This is my activity_main.xml
code
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.deedat.webtry2.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
My Logcat shows this:
01-10 19:26:15.552 17316-17316/? I/zygote: Not late-enabling -Xcheck:jni (already on) 01-10 19:26:15.562 17316-17316/? W/zygote: Unexpected CPU variant for X86 using defaults: x86 01-10 19:26:15.793 17316-17316/com.example.deedat.webtry2 I/InstantRun: starting instant run server: is main process 01-10 19:26:15.929 17316-17316/com.example.deedat.webtry2 D/AndroidRuntime: Shutting down VM 01-10 19:26:15.932 17316-17316/com.example.deedat.webtry2 E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.deedat.webtry2, PID: 17316 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.deedat.webtry2/com.example.deedat.webtry2.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class uses-permission at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class uses-permission Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class uses-permission Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.uses-permission" on path: DexPathList[[zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/base.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.deedat.webtry2-qFM_P6edDm6em-M-SNtV1g==/lib/x86, /system/lib, /system/vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.view.LayoutInflater.createView(LayoutInflater.java:606) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:703) at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:68) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:995) at android.view.LayoutInflater.rInflate(LayoutInflater.java:859) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 01-10 19:26:15.933 17316-17316/com.example.deedat.webtry2 E/AndroidRuntime: at com.example.deedat.webtry2.MainActivity.onCreate(MainActivity.java:22) at android.app.Activity.performCreate(Activity.java:6975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
My Android app stops at opening, but Android studio shows no error. Can somebody help please? I'm trying to convert my website into an android app. I'm a little new at this.