Android Studio (Ionic Gradle) - App isn't installed after Building - android-studio

Problem After building, running in Android-Studio-Emulator: "App isn't installed".
What to do?
--Android Studio 2020.3
--Android SDK 30, Tools 30.0.2
--Gradle 7.0.2
...
I fail to see any proper Log in the emulator, maybe it's just me but coming from XCode this Android Studio is very poorly built, too bad. Hope someone can help.
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.midix.finance">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name="com.midix.finance.MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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/custom_url_scheme" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths"></meta-data>
</provider>
</application>
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Camera, Photos, input file -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Geolocation API -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />
<!-- Navigator.getUserMedia -->
<!-- Video -->
<uses-permission android:name="android.permission.CAMERA" />
<!-- Audio -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
</manifest>

Android studio is not poorly built. You need to learn its UI/UX and its functions just like how you learnt xCode.
I recommend debug your app in physical device. So connect your phone to the computer using USB cable (USB debugging must be turned on in your device).
Your device name must show in the place where Pixel 2 API 30 showing in your Android Studio screen.
Click on play button next to the device. After gradle building, app will be installed on your device. Authenticate your installation in your phone (Something says "Install this app?") after clicking play button.
Open "Logcat" option at the bottom to see any serious error logs coming.
If your app not installed means search the Logcat with your App package name. It will show why app not installed. Post your Logcat error to get accurate solution.

Related

Failed to parse XML in Android Manifest after update

I have an app I was working on a few months ago. Today I opened it again in Android Studio 3.4 and when syncing it asked if OK to upgrade to the current version of Gradle and the Gradle plug-in. I agreed and I now get an XML parsing error in the manifest.
The manifest is here, I added a comment to signal where I get the error:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.schalkx.alarmapp01">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SetAlarmActivity">
android:label="Alarm Settings"
android:parentActivityName=".MainActivity" <!-- *** I GET THE ERROR HERE *** -->
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
<activity android:name=".ShowClockActivity">
android:label="Desktop Clock"</activity>
<receiver android:name=".AlarmReceiver" />
<activity
android:name=".UserResponseActivity"
android:label="#string/title_activity_user_response" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
</manifest>
I did some tests adding a new activity and I noticed that the syntax is now generated a bit differently, and would start like this:
<activity
android:name=".SetAlarmActivity"
android:label="Alarm Settings"
android:parentActivityName=".MainActivity"
....
That is, the ">" is not added at the end of
<activity android:name=".SetAlarmActivity">
but later on. Trouble is I haven't been able to get the syntax right.
Any ideas what's wrong?
Thanks!
It should be
<activity android:name=".SetAlarmActivity"
android:label="Alarm Settings"
android:parentActivityName=".MainActivity"> //<--Notice
Instead of
<activity android:name=".SetAlarmActivity"> //<--Notice
android:label="Alarm Settings"
android:parentActivityName=".MainActivity"

My App keep crashing and display "app has stopped working" I dont understand the trace in logcat

This is the manifest file
<?xml version="1.0" encoding="utf-8"?>
<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_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permissions.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".Map"
android:label="#string/title_activity_map">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
This app is suppose to find nearby places but whenever i click the button to search nearby places, it crashes
This is the logcat image but i dont understand

Error while generating APK

I'm trying to generate an APK from Android Studio for publish it on the play store.
Now when i generate the APK i got this error:
I can start the app but "Generate APK" not work and for avoid this error i copy my Facebook App Id from my string.xml to my manifest:
android:value="2132153153153535"
Instead of:
android:value="#string/facebook_app_id"
Now i can generate the APK but when i launch my app from the playstore i got this error:
Unable to start activity ComponentInfo{com.stable.giamma.sushichallenge/com.stable.giamma.sushichallenge.MenuActivity}: java.lang.IllegalArgumentException: Both context and applicationId must be non-null
That i can resolve by reversing the modify that i just did.
But if i do so i can't generate the APK again.....
What is the right way for handle the "facebook app id" and generate the APK?
p.s: i have 2 string.xml (one is for english and the other for italian language) dunno if create some problem...
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asd.appname">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
o
<application
android:allowBackup="true"
android:icon="#mipmap/asd"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" /> //THIS IS THE STRING THAT I MODIFY FOR AVOID THE FIRST ERROR
<activity
android:name="com.asd.MainActivity"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name="com.asd.MenuActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.asd.SushataActivity"
android:label="#string/sushata"
android:parentActivityName="com.asd.MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.asd.MenuActivity" />
</activity>
<activity
android:name="com.asd.Sushata2Activity"
android:label="#string/sushata2"
android:parentActivityName="com.asd.SushataActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.asd.SushataActivity" />
</activity>
<activity
android:name="com.asd.Leaderboard"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>
I added:
tools:ignore="ManifestResource"
The correct code is:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"
tools:ignore="ManifestResource"/>
Now seems work I found this stackoverflow post helpful: link

Android Studio error related to Google Play Services

I get these errors while building a signed apk using Android Studio. Help me build the app please.
1.
Error:(42, 28) No resource found that matches the given name (at
'value' with value '#integer/google_play_services_version').
2.
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command
'/home/dna/Android/Sdk/build-tools/23.0.2/aapt'' finished with
non-zero exit value 1
This is my AndroidManifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="appen.woltlab_bb"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="appen.woltlab_bb.SplashScreen"
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="appen.woltlab_bb.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="appen.woltlab_bb.MAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!--
ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
I got it fixed. It was caused due to having accidentally including some auto generated API indexing code from a similar project by me. In case you have this issue, just start from scratch and be careful with what you import from your previous project.

java.net.SocketException:socketfailed:EACCES(permission denied) for OTP application in Android Studio

I am trying to create an One time password access android application. I have created a local host server using wamp and I am trying to access that thing with the mobile application I have designed. Unfortunately, I am getting the error as following in my log cat:
03-07 10:42:35.097 31217-31217/com.example.user.myapplication V/ActivityThread: updateVisibility : ActivityRecord{1ecab2fb token=android.os.BinderProxy#23c38b5b {com.example.user.myapplication/com.example.user.myapplication.activity.SmsActivity}} show : true
03-07 10:42:36.607 31217-31217/com.example.user.myapplication I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy#23c38b5b time:52633449
03-07 10:42:37.397 31217-31217/com.example.user.myapplication D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
03-07 10:42:37.537 31217-32544/com.example.user.myapplication E/SmsActivity: Posting params: {email=thomasbi#gmail.com, name=Thomas, mobile=9002378900}
03-07 10:42:37.537 31217-32544/com.example.user.myapplication I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
03-07 10:42:37.537 31217-32544/com.example.user.myapplication I/System.out: KnoxVpnUidStorageknoxVpnSupported API value returned is false
03-07 10:42:37.547 31217-31217/com.example.user.myapplication E/SmsActivity: Error: java.net.SocketException: socket failed: EACCES (Permission denied)
03-07 10:42:37.617 31217-31217/com.example.user.myapplication D/SRIB_DCS: log_dcs ThreadedRenderer::initialize entered!
I have included all of the permissions, here's my AndroidManifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<application
android:name=".app.MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/MyMaterialTheme">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<activity
android:name=".activity.SmsActivity"
android:label="#string/title_activity_sms">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.MainActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize">
</activity>
<!-- SMS Receiver -->
<receiver android:name=".receiver.SmsReceiver">
<intent-filter android:priority="99999">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<!-- Intent service -->
<service
android:name=".service.HttpService"
android:exported="false" />
</application>
I am bit confused at the moment and I understand I am stuck with something silly. I would be deeply obliged if anyone could help me with the issue.
If you are targeting API 23+ (Marshmallow), permission requests are made when a permission is required, not doing so can result in an unwanted user experience.
This site has a good explanation and examples:
http://www.captechconsulting.com/blogs/runtime-permissions-best-practices-and-how-to-gracefully-handle-permission-removal

Resources