Pracuję nad aplikacją, w której muszę utworzyć Lunar Calendar
Tworzę niestandardowy Kalendarz Księżycowy. W Kalendarzu Księżycowym jest bardzo ograniczony kod. Ale jakoś uda mi się go stworzyć. To jest mój kod.Wyjątek java.lang.RuntimeException: Nie można rozpocząć działania KomponentInfo
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webView = (WebView)this.findViewById(R.id.wv);
webView.loadUrl(contentUri);
// webView.loadUrl("file://D:/Andro_WS_2/LunarCalendar/assets/calendar.html");
mGestureDetector = new GestureDetector(this);
webView.setOnTouchListener(this);
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
e.printStackTrace();
}
webView.loadUrl("javascript:pushBtm('MU')");
webView.loadUrl("javascript:pushBtm('MD')");
if(!ConfigCenter.getValue(this, Constant.KEY_WIDGET_ADDED, false)){
Toast.makeText(MainActivity.this, "Please Wait", Toast.LENGTH_LONG).show();
}
}
i po uruchomieniu tego kodu ulega awarii. Mój błąd logcat pokazuje:
03-20 04:51:41.197: E/AndroidRuntime(967): FATAL EXCEPTION: main
03-20 04:51:41.197: E/AndroidRuntime(967): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lunarcalendar/com.example.lunarcalendar.MainActivity}: android.view.InflateException: Binary XML file line #23: Error inflating class net.youmi.android.AdView
03-20 04:51:41.197: E/AndroidRuntime(967): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.os.Handler.dispatchMessage(Handler.java:99)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.os.Looper.loop(Looper.java:137)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-20 04:51:41.197: E/AndroidRuntime(967): at java.lang.reflect.Method.invokeNative(Native Method)
03-20 04:51:41.197: E/AndroidRuntime(967): at java.lang.reflect.Method.invoke(Method.java:511)
03-20 04:51:41.197: E/AndroidRuntime(967): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-20 04:51:41.197: E/AndroidRuntime(967): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-20 04:51:41.197: E/AndroidRuntime(967): at dalvik.system.NativeStart.main(Native Method)
03-20 04:51:41.197: E/AndroidRuntime(967): Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class net.youmi.android.AdView
03-20 04:51:41.197: E/AndroidRuntime(967): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-20 04:51:41.197: E/AndroidRuntime(967): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.app.Activity.setContentView(Activity.java:1881)
03-20 04:51:41.197: E/AndroidRuntime(967): at com.example.lunarcalendar.MainActivity.onCreate(MainActivity.java:44)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.app.Activity.performCreate(Activity.java:5104)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-20 04:51:41.197: E/AndroidRuntime(967): ... 11 more
03-20 04:51:41.197: E/AndroidRuntime(967): Caused by: java.lang.ClassNotFoundException: Didn't find class "net.youmi.android.AdView" on path: /data/app/com.example.lunarcalendar-2.apk
03-20 04:51:41.197: E/AndroidRuntime(967): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
03-20 04:51:41.197: E/AndroidRuntime(967): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-20 04:51:41.197: E/AndroidRuntime(967): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
03-20 04:51:41.197: E/AndroidRuntime(967): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
03-20 04:51:41.197: E/AndroidRuntime(967): ... 21 more
i mój XML jest
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:umadsdk="http://schemas.android.com/apk/res/com.china.calendar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/white"
android:orientation="vertical" >
<WebView
android:id="@+id/wv"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<net.youmi.android.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
Czy dodano biblioteki za reklamy w katalogu libs Twojego projektu? – GrIsHu
Zamieść swój plik manifestu lub sprawdź, czy dodano wiersz ' 'w twoim manifeście? –
GrIsHu
Tak, Grishu, dodałem bibliotekę. – Prinkal