I'm trying to change a ConstraintLayout to RelativeLayout in XML. Every time I do, I get the Missing Classes error:
The following classes could not be found: android.support.constraint.RelativeLayout
What am I missing?
RelativeLayout is not inside that package, you should use :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
Or if you are importing inside your class:
import android.widget.RelativeLayout;
Related
I am developing a library for Android, and this library has some activities with its layouts.
In the layout, I have the next code
...
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.floatingactionbutton.FloatingActionButton
...
I am using Androidx.
An I get the following error:
Error inflating class android.support.constraint.ConstraintLayout
The first attempt to solve this was to changeandroid.support.constraint.ConstraintLayout to androidx.constraintlayout.widget.ConstraintLayout
But when I do this I get the following error:
androidx.constraintlayout.widget.ConstraintLayout cannot be cast to
androidx.constraintlayout.widget.Group
So I try to change to androidx.constraintlayout.widget.Group
I get the following error:
androidx.constraintlayout.widget.Group cannot be cast to
android.view.ViewGroup
I did a refactor again to androidx and then I get the following error:
Didn't find class "androidx.constraintlayout.ConstraintLayout"
Any idea?
Thanks
Follow this steps
First add below dependencies in your Build.Gradle file
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Use this ConstraintLayout like this
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content">
</androidx.constraintlayout.widget.ConstraintLayout>
Make sure you have correct imports of ConstraintLayout for in your activity if you have used
import androidx.constraintlayout.widget.ConstraintLayout
I've got quite weird problem with new AdView creation in layout XML while migrating from old AdMob.
OK.
Product target- Google API 19
Default properties- Google API 8
google play lib is referenced in the project and seems to be dexed and then included into resulting apk (proof is below).
I have the following code in my layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0"
android:orientation="vertical" >
...
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
ads:adSize="BANNER"
ads:adUnitId="#string/admob_unit_id"
/>
When I load the layout I've got the exception.
I see the following suspicious things:
I have specially put code which uses AdView BEFORE the XML loading and have no exception there
com.google.android.gms.ads.AdView ad= new com.google.android.gms.ads.AdView(this);
try
{
setContentView(R.layout.ap_map);
}
catch(RuntimeException e)
{
throw e;
}
So, I assume that there is no prob with google play library inclusion itself.
However, when I debugged the exception- I've got an internal exception- NoClassDefFoundException, so it looks exactly like I have google play lib missed
I have weird probs with AdView declaration- if I declare it as google suggest
I've got an error saying that
- error: No resource identifier found for attribute 'adSize' in package MYPACKAGE
So I had to add
xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
in the top of the layout declaration to get rid of this
Any ideas? I've read a few related topics here and all of them seems to be related with google play lib absence but it does not seem to be the case
Change :
xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
to:
xmlns:ads="http://schemas.android.com/apk/res-auto"
I am trying to use both PullToRefresh and SwipeListView libraries in listview using PullToRefreshSwipeListView custom view class. I have implemented it like that:
First I have imported PullToRefresh library into my project then I have added a SwipeListView Jar File into PullToRefresh library projet by making a libs folder in it. Then I have added PullToRefreshSwipeListView class in the src folder(com.handmark.pulltorefresh.library) of PullToRefresh library project. Finally I am trying to implement this custom class PullToRefreshSwipeListView into my project's xml as:
<com.handmark.pulltorefresh.library.PullToRefreshListView
xmlns:swipe="http://schemas.android.com/apk/res-auto"
xmlns:ptr="http://schemas.android.com/apk/res-auto"
android:id="#+id/lv_Inbox"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:divider="#19000000"
android:dividerHeight="2dp"
android:fadingEdge="none"
android:fastScrollEnabled="false"
android:footerDividersEnabled="false"
android:headerDividersEnabled="false"
android:scrollbars="none"
android:smoothScrollbar="true"
ptr:ptrAnimationStyle="flip" >
<libs.swipelistview.SwipeListView
android:id="#+id/users_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#0000"
android:clipToPadding="false"
android:divider="#null"
android:dividerHeight="0px"
android:fadingEdge="none"
android:scrollbarStyle="outsideOverlay"
swipe:swipeActionLeft="reveal" />
</com.handmark.pulltorefresh.library.PullToRefreshListView>
But I am getting error in xml as:
error: No resource identifier found for attribute 'swipeActionLeft' in package
error: No resource identifier found for attribute 'swipeActionLeft' in package
error: No resource identifier found for attribute 'swipeMode' in package
It does not get any of the swipe attribute but If I remove swipe attributes. It is working fine for only PullToRefresh. I am following this link to implement it. Any Solution/Comments will be most appreciated.
Why are you trying to merge PullToRefresh into SwipeListView library ? I have used PullToRefresh with SwipeListView without no problems (just imported using gradle not JARs).
You are getting these errors because you have not copied swipelistview__attrs.xml from res/values in SwipeListView library (this file)
better you go with
swiperefresh layout
https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html
here is my xml error report
The following classes could not be instantiated:
- com.inmobi.androidsdk.IMAdView (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
and code of main.xml is like this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<com.inmobi.androidsdk.IMAdView
android:id="#+id/imAdview"
android:layout_width="320dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
adSize="15"
appId="a521d7b121144753a4709e018826c487" />
Didn't get issue here ,why i am getting this error ,suggest some solution.
Thanks
Please use the following code in your xml
<com.inmobi.monetization.IMBanner android:layout_width="320dp"
android:layout_height="50dp" android:id="#+id/banner"
adSize="15" appId="YOUR-APP-ID" />
The code you are using is from the old integration guidelines. This will not work for the latest InMobi sdk. For more details please check https://www.inmobi.com/support/integration/23817448/22051163/android-sdk-integration-guide/
Hello I'm importing jazzylistview sample project and i get the following error in the layout file:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.twotoasters.jazzylistview.sample"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background"
tools:context=".MainActivity" >
<com.twotoasters.jazzylistview
android:id="#id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#null"
app:effect="helix"
app:only_animate_new_items="false"
app:only_animate_fling="false"
app:max_velocity="0" />
</FrameLayout>
I get the following error on com.twotoasters.jazzylistview line:
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'only_animate_fling' in package
'com.twotoasters.jazzylistview.sample'
- error: No resource identifier found for attribute 'max_velocity' in package 'com.twotoasters.jazzylistview.sample'
- error: No resource identifier found for attribute 'effect' in package 'com.twotoasters.jazzylistview.sample'
- error: No resource identifier found for attribute 'only_animate_new_items' in package
'com.twotoasters.jazzylistview.sample'
please help me what should i do?
xmlns:app="http://schemas.android.com/apk/res/com.twotoasters.jazzylistview.sample"
here instead of using /com.twotoasters.jazzylistview.sample use your package name.