1

I have added the library to my project.

Then in XML file I am trying to add the HorizontalListView as the following

<com.devsmart.android.ui.HorizontialListView
        android:id="@+id/horizontalList"
        android:layout_width="284dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="10dp"
        android:background="#ddd" />

But it gives the following Exception

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.golfer/com.golfer.WeatherScreen}: android.view.InflateException: Binary XML file line #256: Error inflating class com.devsmart.android.ui.HorizontialListView

Caused by: android.view.InflateException: Binary XML file line #256: Error inflating class com.devsmart.android.ui.HorizontialListView

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.devsmart.android.ui.HorizontialListView" on path: DexPathList[[zip file "/data/app/com.golfer-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.golfer-1, /vendor/lib, /system/lib]]

I have followed the instructions on this site

Any one having any idea about it? Any help?

3 Answers3

1

Replace com.devsmart.android.ui.HorizontialListView by the name of your package +name of the class.

Something like this: com.example.android.MyHorizontalView where com.example.android is the name of your package and MyHorizontalView is the name of the class (that you created).

EDIT

From this post and android developer, you are probably missing a line to declare the namespace of the view. Try adding a line like this one

 xmlns:widget="http://schemas.android.com/apk/res/com.mypackage"

In the parent layout (below the line xmlns:android="http://schemas.android.com/apk/res/android")

Community
  • 1
  • 1
Gordak
  • 2,060
  • 22
  • 32
  • 1
    I did not created the class. The class is in the library I am using. And it is the package name of the library. However I also tried to copy the `HorizontalListView` file from library to my own project and then I used it like `com.mypackage.HorizontalListView` even in that case same issue was there. – AndroidUser Jul 02 '15 at 13:47
  • if you declare an object com.devsmart.android.ui.HorizontialListView in your Activity, can you import the class or do you get a compilation error ? – Gordak Jul 02 '15 at 13:56
  • 1
    That's the point man, I have already imported it like `import com.devsmart.android.ui.HorizontalListView;` and it works there. But not in XML file. – AndroidUser Jul 02 '15 at 13:58
  • 1
    Should I try writing my package name there or library's package name ? – AndroidUser Jul 02 '15 at 14:15
  • same Error am facing . I am using this HorizontialListView class in Remote View. Am using this class only. not library any solution – Akash Kumar Jun 08 '18 at 12:51
0

Did you add the Lib to your Dependencies? If not, add it!

Edit Eclipse: Right-Click on Project-> Build Path-> Configure Build Path-> Libraries-> Check if lib is in there, if not -> add Library.....

Pfennigbaum
  • 356
  • 5
  • 13
0

You can try it the following way,

Add devsmartlib.jar to the libs folder.

Then go to Java Build Path - > Libraries and Add JAR devsmartlib.jar to the project.

gprathour
  • 14,813
  • 5
  • 66
  • 90