cannot resolve method getActionBar in FragmentActivity Support Library - intellij-idea

I opened only untitled project in intellij idea and wrote getActionBar() there is:
java: cannot find symbol
symbol: method getActionBar()
location: class com.example.untitled.MyActivity
and Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.untitled"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7"/>
<application android:label="#string/app_name">
<activity android:name="MyActivity"
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>
</manifest>
what is reason of this?

Related

Task :app:processDebugMainManifest FAILED Manifest Merger Failed with multiple errors in React Native. My current Android Sdk Version 31

I was working fine on my react native project suddenly got this error. Didn't find any solution till now. Spent almost day finding the solution but couldn't find any solution. any kind of help will be appreciated.
my manifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wiltreactnative">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:allowBackup="false"
android:usesCleartextTraffic="true"
android:theme="#style/AppTheme">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="#string/facebook_client_token"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
</application>
</manifest>
Try adding implementation "androidx.test:core:1.4.0" to android/app/build.gradle dependencies enter image description here

React Native: How should I incorporate this code snippet into my existing AndroidManifest.xml?

In my React Native app, I need to add the following code to my AndroidManifest.xml file:
<manifest ...>
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https"/>
</intent>
</queries>
</manifest>
My AndroidManifest.xml file currently looks like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.intowconnect">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_STATE" />
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTop"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
I'm not sure how to incorporate the code snippet into this. Is there a place I can just insert the <queries> block? Or do I need to change the format of my existing file?
Pre Requirement for Android Studio
Android Studio version minimum 4.1.3 with Gradle Plugin 6.8.2
For use queries you should write queries code in out of application tag not inside application tag
<manifest ...>
<application .... />
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https"/>
</intent>
</queries>
</manifest>

I need help i have face problem attribute 'android:name' in <activity> tag must be a valid Java class name

C:\Users\TEHSEEN AFZAL\AppData\yes\rn-course\android\app\build\intermediates\merged_manifests\debug\AndroidManifest.xml:24: AAPT: error: attribute 'android:name' in tag must be a valid Java class name.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
11 actionable tasks: 2 executed, 9 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.(rncourse)"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="com.(rncourse).MainApplication"
android:allowBackup="false"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
android:debuggable="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true" >
<activity
android:name="com.(rncourse).MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
In my case I've removed com.rncourse from android:name both the application and activity tag and it works like a charm!
So, try this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rncourse"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:allowBackup="false"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
android:debuggable="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true" >
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>

Splash screen on Android

I have a problem with the splashscreen on Android. Here is everything what I am doing:
Creating background_splash.xml file:
xml version="1.0" encoding="utf-8"?>
layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="#android:color/darker_gray"/>
<item>
<bitmap
android:gravity="center"
android:src="#drawable/splash"/>
</item>
I remove < in the first two lines because stackoverflow cannot display them. This file is located in drawable.
I added the following to styles.xml:
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">#drawable/background_splash</item>
</style>
and this is my manifest files:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name=".SplashActivity"
android:label="#string/app_name"
android:theme="#style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" />
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
And also the activity:
import android.content.Intent;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
public class SplashActivity extends ReactActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}
This is the error I have:
Starting the app on 51d123cc (adb -s 51d123cc shell am start -n com.test/.MainActivity)...
Starting: Intent { cmp=com.test/.MainActivity }
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.test/.MainActivity } from null (pid=20601, uid=2000) not exported from uid 11152
at android.os.Parcel.readException(Parcel.java:1540)
at android.os.Parcel.readException(Parcel.java:1493)
at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:2589)
at com.android.commands.am.Am.runStart(Am.java:768)
at com.android.commands.am.Am.onRun(Am.java:307)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:102)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:255)
UPDATE:
To the answer of #Ankit Prajapati I will add also that I set
android:largeHeap="true"
which was an error from Android Studio (running from the terminal this error wasn't reported) and this happen after changing activity to SplashActivity.
Also it was necessary to change edit configurations and changing "Launch Activity" to "Specified Activity" and setting com.test.SplashActivity.
Second way of managing splash screen on Android and which I use right now is with this tutorial:
Splash Screen Android
Try using this in
android:exported="true" in the manifest file in the activity you are trying to start (Loading Activity)
Like this
<activity
android:name=".SplashActivity"
android:label="#string/app_name"
android:theme="#style/SplashTheme"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Also Add
Intent intent = new Intent(SplashActivity.this, MainActivity.class);

Failed to find provider info for com.google.android.gsf.gservices

I don't know why Wen run the android app i'm developing, when i want to show maps i obtain an acivity blank with only zoom buttons and the log is:
Failed to find provider info for com.google.android.gsf.gservices
This is the activity that show the map
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
This is the file manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="md.clt.android"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="md.client.android.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="md.client.android.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Allows the API to access Google web-based services -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- Allows the API to cache map tile data in the device's external storage area -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<!-- Google Maps Android API requires OpenGL ES version 2 -->
<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/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="My_apy_key" />
<activity
android:name="md.clt.android.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>
<activity
android:name="md.clt.android.PoiMap"
android:label="#string/title_activity_poi_map" >
</activity>
<activity
android:name="md.clt.android.PoiListActivity"
android:label="#string/title_activity_poi_list" >
</activity>
</application>
</manifest>
What it means?