Cardview elevation is not working with androidx artifacts - android-cardview

My card view elevation stopped working and showing shadow after I updated my android studio 3.3 and migrating my project to androidx artifacts.
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="#dimen/card_margin"
app:cardCornerRadius="#dimen/card_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Other Code-->
</LinearLayout>
</androidx.cardview.widget.CardView>

Add app:cardElevation="10dp" property to cardview.
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="#dimen/card_margin"
**app:cardElevation="#dimen/card_margin"**
app:cardCornerRadius="#dimen/card_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Other Code-->
</LinearLayout>
</androidx.cardview.widget.CardView>

you need to specify app:cardUseCompatPadding="true" in your CardView then set app:cardElevation="4dp" with approbate value
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="12dp"
app:cardCornerRadius="12dp"
app:cardUseCompatPadding="true"
app:cardElevation="4dp">

Related

error after updating minsdkversion in flutter 2.8

I am a beginner in flutter. I have update minSdkVersion from 19 to 21 and getting the following error. Please Please help. any kind of help is much appreciated. Thank you in advance.
Manifest merger failed : Attribute application#label value=(Car_Wash_App) from AndroidManifest.xml:11:9-37
is also present at [org.jfrog.cardinalcommerce.gradle:cardinalmobilesdk:2.2.4-1] AndroidManifest.xml:15:9-41 value=(#string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:9:5-48:19 to override.
here is the manifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.Car_Wash_App">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Car_Wash_App"
android:icon="#mipmap/ic_launcher"
tools:replace="android:label">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
Buddy you just need to migrate your project to androidX
open android directory of your project in android studio
wait for gradle to finish its task
then go to tools -> migrate to androidX
click migrate
click do refactor
or you can simply follow steps from following answer https://stackoverflow.com/a/54857699/16793736
You have to change your android manifest file like below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
<application
android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true">
</application>
</manifest>
To
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.name"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:label="App Name"
android:supportsRtl="true"
tools:replace="android:label">
</application>
</manifest>
And now the android:label is replaced by the label from the parent application.

Flutter http doesn't work in releasebuild

On debug everything works fine. But if I create a releasebuild the Flutter http-libary doesn't work.
I've the internet-permission in my androidmanifest.
Currently I use Flutter 2.5.0 and http 0.13.3.
I've already created a new project, but it doesn't work there either.
<application
android:name="io.flutter.app.FlutterApplication"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="#xml/network_security_config"
android:label="Appname"
android:icon="#mipmap/ic_launcher">
................
</application>
Then inside res folder, create xml folder and add network_security_config.xml
Inside network_security_config.xml file, you may enter specific http url and you may use local api also.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">example.uz</domain>
<domain includeSubdomains="true">example2.uz</domain>
<domain includeSubdomains="true">10.112.52.30</domain>
<domain includeSubdomains="true">192.168.12.81</domain>
</domain-config>
</network-security-config>

Google Maps API V2 no map

i´ve been searching and testing a lot of code, but i can´t get map show in my app.
I have my api key writed in manifest and in the layout of my activity for google maps, but
i only can see map screen without any map, only google logo and grill, i can zoom in and out but no any map view and no zoom buttons, what is the reason?
In LogCat log i only see one error:
E/MapActivity(1024): Couldn't get connection factory client
W/System.err(1024): IOException processing: 26
W/System.err(1024): java.io.IOException: Server returned: 3
W/System.err(1024):at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
Here ismy code.
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.emapps.alarmmap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<permission
android:name="com.emapps.alarmmap.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<permission
android:name="com.emapps.alarmmap.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.emapps.alarmmap.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.emapps.alarmmap.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCES_NETWORK_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppBaseTheme" >
<activity
android:name="com.emapps.alarmmap.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBxdPiMVTg5_XgRAitoQ5XGyFL8sBTS79A" />
</activity>
<uses-library
android:name="com.google.android.maps" />
<activity
android:name=".MapsView"
android:label="#string/title_activity_maps_view" >
</activity>
</application>
</manifest>
Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="AIzaSyBxdPiMVTg5_XgRAitoQ5XGyFL8sBTS79A"/>
</LinearLayout>
And Activity.java:
package com.emapps.alarmmap;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MapsView extends MapActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
}
I know that this capture is from API V1,im using APi V2,it is only for reference of my problem.
http://img513.imageshack.us/img513/4061/5ay7.jpg
I have tried on AVD and Phones with same result.
Sorry for my english and thanks in advance!
You are mixing deprecated Google Maps Android API v1 with new API v2. Remove all you code and start by following this: https://developers.google.com/maps/documentation/android/start

Android: permissions missing name and tags

I am quite new to Android programming and am attempting to create an app, but I wanted to make sure that I have everything correct and error free before I do. I have the following errors in my manifest file: missing name attribute in element ....and tag permission missing required attribute name. I thought I did have a name in permission ("#string/app_name") but the error is still there! here is a copy of the code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="s.p.cunningham.checkyournumberslotteryapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<permission android:name="#string/app_name"></permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="s.p.cunningham.checkyournumberslotteryapp.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Delete the whole tag. It is not a requirement in most of the cases, but god know's why comes as default when you create a new android application project.
If it isn't required, you can delete that tag... if you want to add any permission, then , delete that and use
<uses-permission
android:name="your permission....."
/>

Emulator not displaying any controls, need help!

I am new to android development.
I have added some controls in main.xml but they fail to show up on the emulator.
Please tell me what am I doing wrong.
Here is my xml;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center" android:text="#string/app_name"
android:textSize="30dp"/>
<EditText android:id="#+id/editable"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android.Text="Text goes here " android:layout_weight="1" android:hint="#string/display"/>
<Button android:id="#+id/button"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="#string/mainPageButton"
android:textSize="25dp"/>
</LinearLayout>
Do you have:
setContentView(R.layout.main);
in your onCreate method in your activity?