I converted a legacy Android app to library and placed it into my current flutter project to call it using Method Channel. It's working fine, but the problem is that flutter is installing those two apps at the same time and showing two icons on device screen! Even using this second app as library and dependency. Flutter is installing both as regular apps.
I am using flutter 1.7.8.
I tried to follow this answer -> How to use a library project in android studio
I would like to install only my flutter app and using the second one as library/dependency inside of it.
You have to changes the types of your second module as library, change
apply plugin: 'com.android.application'
into
apply plugin: 'com.android.library'
on the build.gradle of your module.
and also remove any intent filter main and launcher on these module.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Remove these part.
You might have two activities with below code.
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Use above code with only one activity, otherwise android launch two application at the same time.
For example, Use this in your code.
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
android:hardwareAccelerated="true"
android:theme="#style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Related
I am trying to using Payu gateway integration.So i added dependency implementation 'com.payumoney.sdkui:plug-n-play:1.6.0' .After sync **Default activity not found ** coming.
Dont understand error. if i remove dependency ,its working fine.
Build.gradle:
implementation 'com.payumoney.sdkui:plug-n-play:1.6.0'
Manifest FIle :
<activity
android:name=".activity.SplashActivity"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Add tools:replace="android:allowBackup,android:usesCleartextTraffic" in the App Manifest file and
Invalidate and Restart the project once.
I have 2 project (A and B) A is the sdk and the other is an application that uses sdk.
I want to join A to B with gradle and i don't know how.
Thanks
you need to show a new MainActivity instance you need to declare an intent-filter in your project B manifest:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="your.package.here.MainActivity" />
<category android:name="android.intent.category.DEFAULT" />
I have a problem when I try to debug the App on my Phone. The App works, but It is not installed on the device. When I created the project I selected a project without Activity (option: "Add No Activity"). If I create an App with a blank Activity, this is installed when I launch the debug. I'm using Android Studio for the project.
What can I do? Thanks!
Because you have to Specify Your App's Launcher Activity. You should put this line into your manifest in actvity tag like this, For more reference check this link Specify Your App's Launcher Activity
<activity
android:name=".DemoActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize|stateVisible" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.categor.LAUNCHER" />
</intent-filter>
</activity>
Problem solved!
Android Studio is stupid, it adviced me to write this in capital letters
<action android:name="ANDROID.INTENT.ACTION.MAIN" />
<category android:name="ANDROID.INTENT.CATEGORY.LAUNCHER" />
instead
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
I'm using Android studio for making android app.
but i have a problem that when i run the app , i found 3 apps on my device ,and all of them belonging to the same APK file.
also i'm sure that the mainfeest.xml has one <intent-filter>
<activity
android:name="com.amman.android.MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
but i guess the problem from Build Veriants , but im not sure :(
what are the names of other apps? during the android studio build/gradle build there is a manifest merge which combines all the manifests in the library projects u included. I assume the 'other' apps are from them, try removing
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
from the all lib projects manifests
I got this warning from console when running my application on emulator
No Launcher activity found!
The launch will only sync the application package on the device!
In fact i have declared an activity as the main launcer in AndroidManifest.xml file
<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>
I don't need any other intent-filter to use on that activity.. just basic main and launcher
What's the reason? Please give me a solution..
If the launcher activity is in another package, you will need to specify that as well.
For instance, from one of my personal projects:
<activity
android:name=".activities.MainScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The MainScreen.java is in the activities package. Also, check spelling for upper or lower case letters.
It seems that you must have "android.intent.action.MAIN" specified immediately before "android.intent.category.LAUNCHER". I encountered the same issue as you when I had the following:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The issue was resolved only when I re-orderd as follows:
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
In all normal circumstances, listen to what the other guy(s) said.
I was able to replicate your issue using a Mac Book Pro & Eclipse Indigo. when you create your android project, you MUST have Eclipse start you off with a templated activity (like a blank activity). if you don't, and you try to add an activity to your manifest later, Eclipse just derps and can't find the launcher. (i looked at other manifest files and i can't see any differences. i really don't think it's your poor manifest's fault in this special case.)
here's your lazy easy fix:
start a new project, and copy over all the files (make sure you back up ur files first, in case you delete something wrong or mess up the ordering)
Using Eclipse Indigo, open Run Configurations windows, click the project and use launch default activity on Android tab, choose Automatically pick compatible device...and apply.