When I execute the following command
adb shell am startservice vision.fastfiletransfer/com.android.tools.fd.runtime.InstantRunService
it has the error
Error while executing: am startservice vision.fastfiletransfer/com.android.tools.fd.runtime.InstantRunService
Starting service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=vision.fastfiletransfer/com.android.tools.fd.runtime.InstantRunService }
Error: Requires permission private to package
And I use AndroidStudio 2.3 to debug,what is wrong? What is more,my AndroidManifest is like this.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="vision.fastfiletransfer" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:name="base.APP">
<activity
android:name=".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=".ShareActivity"
android:label="#string/title_activity_share" >
</activity>
</application>
</manifest>
I had the same problem and I found two solutions that worked for me.
Solution 1. This doesn't need to change your SDK. You have to go File > Settings > Build, Execution, Deployment > Instant Run and uncheck the first checkbox to disable Instant Run.
Solution 2. The emulator device has to give autolunch permission to the app. In most of devices and older SDK platforms, it is already set. But in my case (Nexus 5s, android-25), this permission doesn't exist anymore.
I had to choose an older device (older API) and it worked.
I had the same question in my project since upadted Android studio to 2.3 ,it seems that there is a studio's bug. You can try to use 2.2.3 .
Related
I am working on a demo project for my Pluralsight training course, and am trying to do something as simple as adding a new activity through Android Studio UI. I right-click on the main folder under "Java" folder (normal android folder structure) and choose 'activity'...'navigation drawer activity'. I go through all the wizard steps, and the new entry gets made in the AndroidManifest.xml file. Yet, the UI resource xml file doesn't get created and kotlin .kt file doesn't get created, either. I have a Windows 10 machine and a Kubuntu 20.04 machine and have gotten this same behavior on both.
Here are the Android studio build details from my Kubuntu machine, which I use the most:
Android Studio 4.0.1
Build #AI-193.6911.18.40.6626763, built on June 24, 2020
Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.4.0-42-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 2014M
Cores: 4
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins:
This is the AndroidManifest.xml file. the activity I am trying to add is called .ItemActivity. The IDE is underlining it in red, saying that I don't have the accompanying class file and the resource file in the project, but I already know that.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.notekeeper" >
<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:name=".ItemsActivity"
android:label="#string/title_activity_items"
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=".NoteListActivity"
android:label="#string/app_name"
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=".NoteActivity"
android:label="#string/note_edit"
android:theme="#style/AppTheme.NoActionBar" />
</application>
</manifest>
I have been following a YouTube tutorial on 2D Game development and when I pressed the run button to check, it shows:
Error runing "app": Default Activity not found
Also it shows an error on AndroidMainfest.xml if I use landscape instead of fullsensor:
<activity android:name=".GameActivity"
android:screenOrientation="landscape"
android:theme="#style/AppTheme.noActionBar"></activity>
<activity
android:name=".MainActivity"
android:screenOrientation="landscape"
android:theme="#style/AppTheme.noActionBar"></activity>
Use intent-filter:
<activity
android:name=".MainActivity"
android:screenOrientation="landscape"
android:theme="#style/AppTheme.NoActionBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And why #style/AppTheme.noActionBar? Use #style/AppTheme.NoActionBar.
See also "Default Activity Not Found" on Android Studio upgrade.
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"
I am new to android development and I really find it all messy and confusing at times. I was running My project which worked alright before then Copied an activity and changed the package name which worked fine. I closed the android studio. Now when I opened my project again I started getting the error "Error while launching:: No default Activity found" but I had it in AndroidManifest.xml. Then I tried the "Edit Configuration-> General ->Launch app and set it to Splashscreen. Now I am getting this new error which is too stubborn to disappear ! I have tried everything but nothing really worked for me. Kindly help me out I may be missing something stupid.
$ adb shell am start -n"com.example.dell.optasiaapp/com.example.dell.optasiaapp.Splashscreen" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.example.dell.optasiaapp/com.example.dell.optasiaapp.Splashscreen" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat= [android.intent.category.LAUNCHER] cmp=com.example.dell.optasiaapp/.Splashscreen }
Error type 3
Error: Activity class {com.example.dell.optasiaapp/com.example.dell.optasiaapp.Splashscreen} does not exist.
Error while Launching activity
What I have tried:
Clean project and rebuild
Uninstalling app, disconnecting the mobile and reconnecting to build again
Deleting.idea/workspace.xml
adding Application id = "Pakage name" in gradle build
Changing android:name=".Splashscreen" to android:name="com.example.dell.optasiaapp.Splashscreen"
File -> Invalidate Caches / Restart...
My AndroidManifest code is
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"></application>
<activity android:name=".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=".HomeScreen">
<intent-filter>
<action android:name="com.example.dell.optasiaapp.HomeScreen" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity android:name=".AboutUs">
<intent-filter>
<action android:name="com.example.dell.optasiaapp.AboutUs" />
<category android:name="android.intent.category.About" />
</intent-filter>
</activity>
<activity android:name=".Help" > </activity>
This is so stupid. I tried everything available on Internet but nothing worked for me. So I just made a new project and copy pasted every code to the new empty activities. It runs fine now.
If you change the package name manually, try this:
In build.gradle change
apply plugin: 'android-library'
to
apply plugin: 'com.android.application'
One of the worst things that I have faced in Android Studio.
Follow following steps:
Close your Android Studio.
Delete .idea/workspace.xml
Launch Android Studio and launch your application.
I was having the same problem, emulating the app and trying in other phones worked perfect, only with my phone was failing.
Something that work for me was deleting all other user profiles, including the guest user.
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.