class file for android.support.v4.widget.TintableCompoundButton not found - android

I want to Create a CheckBox, My compile
sdk version is 23,
Target version is 23,
build tool version is 23.0.0,
in gradle I'hv added
compile 'com.android.support:support-v4:23.2.0',
compile 'com.android.support:appcompat-v7:23.2.0'
both and in menifest given the app theme as android:theme="#style/Theme.AppCompat.Light.NoActionBar" and no specific theme to Activity. when I run my code its throwing
InflateException line number #23 at xml file, problem while inflating kind of
Then I decided to convery a simple ChcekBox to android.support.v7.widget.AppCompatCheckBox but on the xml file Preview its showing Rendering Problems The following classes could not be instantiated:
- android.support.v7.widget.AppCompatCheckBox
Exception Details java.lang.ClassNotFoundException: android.support.v4.widget.TintableCompoundButton
and if i try to run it it gives me class file for android.support.v4.widget.TintableCompoundButton not found.
So, Any one faced this issue?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="match_parent"
android:background="#color/white"
android:orientation="vertical">
<LinearLayout
android:id="#+id/lnv_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rlv_header"
android:orientation="vertical">
<android.support.v7.widget.AppCompatCheckBox
android:id="#+id/confirmCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:checked="false"
android:gravity="start"
android:text="#string/personal_confirm_text"
android:textColor="#color/black"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:id="#+id/rlv_next"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="40dp"
android:background="#color/crabfx_light_gray"
android:visibility="gone">
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentTop="true"
android:background="#color/crabfx_green" />
<TextView
android:id="#+id/tv_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:drawablePadding="10dp"
android:drawableRight="#drawable/discloser"
android:gravity="center_vertical"
android:text="#string/lbl_next"
android:textColor="#color/black"
android:textSize="18sp" />
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="#color/crabfx_green" />
</RelativeLayout>
</RelativeLayout>
and below is the theme to Application tag in menifest
android:theme="#style/Theme.AppCompat.Light.NoActionBar"

Related

android.support.v7.widget.AppCompatTextview Failed to instataniate

i am having problem, failed to instantiate one or more classes.Following classes cannot be instantiate .
android.support.v7.widget.AppCompatTextview
There it is my xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/iv_comment_owner_display"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="#drawable/facebook" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/tv_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Username"
android:textColor="#android:color/black"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text=""
android:textColor="#android:color/black" />
</LinearLayout>
</LinearLayout>
AppCompatTextView was added in appcompat-v7:22.1.0
Please check you appcompat version. You have to update your gradle file with this.
clean/Rebuild project from Android Studio,it might help.
If it doesn't try to invalidate caches and restart android studio.
If you have not done,
Try adding the dependencies in your build.gradle(Module:App)
please check the version according to your app
dependencies {
compile 'com.android.support:design:25.3.1'
}
Try putting this code in your layout
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello world"
android:textSize="18dp"
/>
because i see no AppCompatTextView in your layout.

updating design and support libs broke UI

currently we are using design and support libs 23.1.1 , when i updated to 25 there is a big gap in the layout and i can't figure out why
unfortunately i need more reputation to post links , all the links inside the file , sorry.
https://gist.github.com/xxqxpxx/a652a0c26a132913cd67faf21a670515
included files : build.gradle , layoutfile.xml , fragmentfile.xml , mainactivity ,activity1.
screenshot before :
screenshot after :
In your layout file change the root Linear layout height form match_parent to wrap_content
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/authors_and_publishers_simpleDraweeView_margin_left"
android:orientation="vertical">
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/authors_and_publishers_simpleDraweeView"
android:layout_width="#dimen/author_publishers_simpledraweeview"
android:layout_height="#dimen/author_publishers_simpledraweeview"
android:layout_gravity="center_horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/authors_publishers_name_layout_margin_top"
android:orientation="vertical">
<com.kotobi.widget.fonts.views.textviews.RobotoLight
android:id="#+id/authorName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:lines="1"
android:text="Name"
android:textSize="#dimen/author_publisher_pop_up_followrs_text_size" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/authors_and_publishers_simpleDraweeView_margin_top">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="#dimen/author_publisher_pop_up_image_dimen"
android:layout_height="#dimen/author_publisher_pop_up_image_dimen"
android:layout_gravity="center_vertical"
android:layout_marginRight="#dimen/author_publisher_pop_up_image_dimen_margin_right"
android:background="#drawable/followers" />
<com.kotobi.widget.fonts.views.textviews.RobotoLight
android:id="#+id/numberOfFollowers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="12"
android:textColor="#color/grey"
android:textSize="#dimen/author_publisher_pop_up_followrs_number_books" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true">
<ImageView
android:layout_width="#dimen/author_publisher_pop_up_image_dimen"
android:layout_height="#dimen/author_publisher_pop_up_image_dimen"
android:layout_gravity="center_vertical"
android:layout_marginRight="#dimen/author_publisher_pop_up_image_dimen_margin_right"
android:background="#drawable/number_books" />
<com.kotobi.widget.fonts.views.textviews.RobotoLight
android:id="#+id/numberOfBooks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="12"
android:textColor="#color/grey"
android:textSize="#dimen/author_publisher_pop_up_followrs_number_books" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>

Android Studio 2.3 not displaying layout designs

I've just upgraded to Android Studio 2.3, but when I try to display this layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="#dimen/card_margin"
android:elevation="3dp"
app:cardBackgroundColor="#color/transparent"
android:background="#color/transparent"
app:cardCornerRadius="#dimen/card_album_radius">
<RelativeLayout
android:id="#+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:clickable="true"
android:scaleType="fitCenter" />
<ImageView
android:id="#+id/alarm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/toolbar_alarm"
android:alpha="0.35"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:paddingBottom="#dimen/songs_count_padding_bottom"
android:paddingLeft="#dimen/album_title_padding"
/>
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="#dimen/songs_count_padding_bottom"
android:paddingLeft="#dimen/album_title_padding"
android:paddingRight="#dimen/album_title_padding"
android:layout_toRightOf="#id/alarm"
android:layout_alignParentBottom="true"
android:textSize="#dimen/songs_count"
tools:text="Sample Title" />
<TextView
android:id="#+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16sp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:textColor="#color/album_title"
android:textSize="#dimen/note_card_title"
android:textStyle="normal"
/>
<ImageView
android:id="#+id/overflow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop"
android:src="#drawable/ic_dots" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
I receive this error from interface designer (layout editor):
The following classes could not be found:
- android.support.v7.app.WindowDecorActionBar (Fix Build Path, Edit XML, Create Class)
- android.support.v7.widget.ActionBarContainer (Fix Build Path, Edit XML, Create Class)
- android.support.v7.widget.ActionBarContextView (Fix Build Path, Edit XML, Create Class)
- android.support.v7.widget.ActionBarOverlayLayout (Fix Build Path, Edit XML, Create Class)
- android.support.v7.widget.ContentFrameLayout (Fix Build Path, Edit XML, Create Class)
Clicking on Fix Build Path or other links has no effect.
This solved my problem :
Change your style parent to Theme.AppCompat.Light.NoActionBar instead of Theme.AppCompat.Light.DarkActionBar in styles.xml......... it worked for me.
https://stackoverflow.com/a/40067731/305135
Try to check your dependencies. After update to Android Studio 2.3, my gradle broke.
See details

Android Percent Support Library Blank Screen on Actual Device

I tried using the Percent Support Library as detailed here and here. It works nicely in the Android Studio designer, but when I try to install my app into my phone, nothing is showing but an empty screen. What might the problem be?
Edit:
I've added the following lines in my gradle file dependencies.
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:percent:23.0.0'
And here is my fragment layout:
<RelativeLayout 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="match_parent" tools:context="org.atpms.fairfare.ReportFragment"
android:id="#+id/fragment_report" >
<ProgressBar android:id="#+id/report_progress" style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:layout_marginBottom="8dp" android:visibility="gone"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<RelativeLayout
android:id="#+id/report_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/reportButton"
android:gravity="center">
<ImageView
android:id="#+id/report_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/report"
android:adjustViewBounds="true" />
<android.support.percent.PercentRelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="#+id/report_background"
android:layout_alignBottom="#+id/report_background"
android:layout_alignLeft="#+id/report_background"
android:layout_alignStart="#+id/report_background"
android:layout_alignRight="#+id/report_background"
android:layout_alignEnd="#+id/report_background">
<EditText
android:id="#+id/plateNumberField"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_widthPercent="58%"
app:layout_heightPercent="14%"
app:layout_marginTopPercent="20%"
app:layout_marginLeftPercent="36%"
android:textColor="#color/plate_number"
android:background="#null"
android:gravity="center"
android:textSize="24sp"
tools:ignore="TextFields"/>
<ImageView
android:id="#+id/meterPictureButton"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_widthPercent="12%"
app:layout_heightPercent="15.5%"
app:layout_marginTopPercent="38%"
app:layout_marginLeftPercent="84%"
android:src="#drawable/camera" />
<ImageView
android:id="#+id/meterPicture"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_widthPercent="97.2%"
app:layout_heightPercent="42%"
app:layout_marginTopPercent="55.8%"
app:layout_marginLeftPercent="1.6%"
android:scaleType="fitXY"
tools:ignore="ContentDescription" />
</android.support.percent.PercentRelativeLayout>
</RelativeLayout>
<Button
android:id="#+id/reportButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/report"
android:layout_alignParentBottom="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#drawable/report_button"
android:textSize="20sp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:textColor="#color/button_text"
android:textAllCaps="false"
android:gravity="center"
tools:ignore="UnusedAttribute" />
</RelativeLayout>
</RelativeLayout>
Update:
Ok, I've inflated the exact same layout from an Activity using setContentView, and it works fine. It seems that the problem only arises when I try to use the PercentRelativeLayout in a Fragment layout. It appears that LayoutInflater isn't correctly inflating a layout with PercentRelativeLayout elements, but I'm still unsure and continuing to investigate.
It's not a very nice solution, but I solved this problem by just getting rid of the fragment, and making it a full-blown activity.

Not able to integrate MoPub Banner Code to my Android application

I am using the below link as a reference for integrating Mopub Banner Code to my Android application:
https://app.mopub.com/inventory/adunit/9e96b9fc658144c7a6abd0407ed21187/generate/?status=welcome
I have done with the first steps and am having a problem with the step 2 (Android Banner Code Integration)
I have included:
<com.mopub.mobileads.MoPubView
android:id="#+id/adview"
android:layout_width="fill_parent"
android:layout_height="50dp"
/>
in my layout as below:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background_activated">
<CheckBox android:id="#+id/crime_list_item_solvedCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentRight="true"
android:enabled="false"
android:focusable="false"
android:padding="4dp" />
<TextView android:id="#+id/crime_list_item_titleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="#id/crime_list_item_solvedCheckBox"
android:textStyle="bold"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="Crime title" />
<TextView android:id="#+id/crime_list_item_dateTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/crime_list_item_titleTextView"
android:layout_toLeftOf="#id/crime_list_item_solvedCheckBox"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingTop="4dp"
android:text="Crime date" />
<com.mopub.mobileads.MoPubView
android:id="#+id/adview"
android:layout_width="fill_parent"
android:layout_height="50dp"
/>
</RelativeLayout>
and then I have included
private MoPubView moPubView;
but it's giving the error
'MoPubView cannto be resoled to a type'
Just clear your project along with the mopub-sdk project which is included as library into your project.

Categories

Resources