I created an app by following the tutorial at http://www.techotopia.com/index.php/Using_Fragments_in_Android_-_A_Worked_Example, but I have a error.
LogCat:<
I am also new to Android and encountered the same error today. I could not find a solution that worked for me but one thing was clear to me that this issue occurs when android is not able to resolve a mandatory attribute of one of the elements in layout xml.
So I checked my layout thoroughly and found that by mistake I created an ID
<item type="id" name="login"/>
in ids.xml. This Id was conflicting with attribute
android:imeActionId="@+id/login"
of EditText element.
Hope this helps someone.
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.fragmentexample.ToolbarFragment" on path: DexPathList[[zip file "/data/app/com.example.myfragmentexample-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.myfragmentexample-1, /system/lib]]
This
android:name="com.example.fragmentexample.ToolbarFragment"
Must be
android:name="com.example.myfragmentexample.ToolbarFragment"
cause package name for ToolbarFragment.java
is
package com.example.myfragmentexample;
Similarly for TextFragment
android:name="com.example.myfragmentexample.TextFragment"
In my case Google Maps were not correctly initialized. A message in log console printed about it. I had to add
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
to <application>
inside AndroidManifest.
Try adding correct layouts at correct place like ex. in my case I was putting colors.xml in values-w820p then it was giving runtime exception of classtype. I changed the folder from this to simple value and... taffffda!! it worked! :)