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?
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")
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.
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.....
Related
I am trying to import the .aar in the parent app, the .aar file contains multiple activities and functions,
what I am trying to do here is imported the aar file in the libs folder which is present in the app[directly pasted inside] folder, and then implemented it in build Gradle, but I am getting an android resource link failed.
You can check these images of what I have done in the coding part
this is the error i am getting
and this is how I called the libs folder
I called the lib folder like this
In the manifest file, I try to call the activity like this
in the child manifest I commented on the activity tag, it showed duplicate
can anyone help me to fix this issue, when I click a button in parent activity which is in mainactivity.kt it should go to child activity which is present in aar file, named HomeActivity.
both manifest files
This the new error i am getting
Process: com.example.myapplication, PID: 9182
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/live.hms.app2.ui.home.HomeActivity}: android.view.InflateException: Binary XML file line #46 in com.example.myapplication:layout/activity_home: Binary XML file line #46 in com.example.myapplication:layout/activity_home: Error inflating class androidx.fragment.app.FragmentContainerView
which is
The aar file has it own manifest file in it. You don't need to decare HomeActivity in the manifest file of app module. Android studio can help you merge all the manifest files into one file.
Just directly use HomeActivity in MainActivity:
Intent intent = new Intent(this, HomeActivity.class);
startActivity(intent);
After migration to AndroidX my app crashes after calling Snackbar.make() method. The error looks like
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.design.internal.SnackbarContentLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.internal.SnackbarContentLayout"
It's strange that internal Snackbar method make() is still trying to access SnackbarContentLayout class in old support package instead new material's one. Please advice what I'm doing wrong.
UPDATE
Finally I found a solution. There is a custom layout in my project which overrides
Snackbar's design_layout_snackbar_include and it had wrong class in root view tag:
<view
xmlns:android="http://schemas.android.com/apk/res/android"
class="android.support.design.internal.SnackbarContentLayout"
android:theme="#style/ThemeOverlay.AppCompat.Dark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
I changed it to com.google.android.material.snackbar.SnackbarContentLayout
ensure that your project is set up to migrate old packages to Androidx by including this in your gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
I have used smaple Code of Xamarin.Andoird.Support.v7.Cardview though i get an bellow error
Caused by: android.view.InflateException: Binary XML file line #1:
Error inflating class android.support.v7.widget.CardView
Remove Android Support Library v7 CardView component and add it again! Rebuild the project and it's done! you should not be getting this error now!
I tried the same and it worked.
I have two custom components, one which I made quite recently, both in Android Studio. The earlier one worked. I followed the same procedure to make the new one but it throws runtime errors when I reach the activity screen during testing.
These are the exception messages, listed in order:
1. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sentient/com.mycompany.MyActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class <unknown>
2. Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class <unknown>
3. java.lang.reflect.InvocationTargetException
4. java.lang.NoClassDefFoundError: com.mycomponent.R$color
Error #4 shows the actual line itself that throws the error, it is part of the constructor of the component:
int color = res.getColor(R.color.progress_gray);
I checked the R file manually, and found the colors (progress_gray is defined in the colors.xml) to be present. I removed the line, and another line throws the error instead (which again depends on the R file to get information).
I have tried cleaning, changing build order in gradle, Make the component separately, and I still can't figure out where the mistake is. Any help is appreciated! Thanks.
can you post the xml file of the custom view?
Check if you have added to your main layout of the custom view xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
I got the solution. The applicationId in build.gradle and the package in the manifest were not matching. Once I changed it, it worked.
Strange though, I had thought that the reason the two were separated was so that they could be named differently. In any case, that was what got it working.
Im my app I want to use this NumberPicker:
https://github.com/SimonVT/android-numberpicker
I've copied the .jar file from this project, build the path in Eclipse, and imported it at my MainActivity class.
My xml file has the following code:
<net.simonvt.widget.NumberPicker
android:id="#+id/numberPicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
But I am getting this error at LogCat:
11-21 15:12:41.486: E/AndroidRuntime(6315): java.lang.RuntimeException: Unable to start activity ComponentInfo{xxxxxxxx.MainActivity}: android.view.InflateException: Binary XML file line #138: Error inflating class net.simonvt.widget.NumberPicker
11-21 15:12:41.486: E/AndroidRuntime(6315): Caused by: android.view.InflateException: Binary XML file line #138: Error inflating class net.simonvt.widget.NumberPicker
11-21 15:12:41.486: E/AndroidRuntime(6315): at net.simonvt.widget.NumberPicker.<init>(NumberPicker.java:532)
What is happening?
Thank you!
You have to add your lib form java build path. just right click the properties and then find java build path to add your jar.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res/net.simonvt.widget.NumberPicker"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<net.simonvt.widget.NumberPicker
android:id="#+id/numberPicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout
Try this.