App name issue with Imported Cordova android app - android

I am creating android app using Cordova. For that I am using the following commands in cmd.
cordova create example com.path.example ExampleApp
cd example
cordova platform add android
cordova plugin add cordova-plugin-network-information
cordova build android
After these process and copying all webpage codings in assets/www folder successfully.
After this
I import it into eclipse the project is created as MainActivity not ExampleApp. Also I cannot change the App name. I changed app name in config.xml and AndroidManifest.xml file and tried many things. But no use.
so I created a new project and imported. But I cannot import that app because of the new app also have the MainActivity as app name. I googled and searched more over in Stackoverflow and other sites. But cannot fix. Please advise.

We can solve this problem by doing following steps,
Open AndroidManifest.xml file from
platforms->android->AndroidManifest.xml
Change as android:name="Project_name" and
android:label="#string/app_name" in activity
<application android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/app_name" android:launchMode="singleTop" android:name="FLP" android:theme="#android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
After that import your project into eclipse.

Related

Could not identify launch Activity: Default Activity not found

I'm new to android and I have encounterded a problem.
The console said that "Could not identify launch activity: Default Activity not found".
I have add
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
in manifests.
And I have tried Invalidate caches/Restart,still not worked.
And the class file which contains the main activity turn green in android studio. I don't know what that means.
This is my manifests file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mrrobot.mycoolweather" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<Activity android:name="com.example.mrrobot.mycoolweather.activity.ChooseAreaActivity"
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>
The chooseAreaActivity is the one I want to use as launcher activity.
For main activity in your manifest you have to add this with category LAUNCHER (First Activity on launch app):
<activity
android:name=".MainActivity"
android:label="YourAppName"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
For other activity you have to change category to DEFAULT:
<activity
android:name=".OtherActivity"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="package.OtherActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Check this Activity and this Start Another Activity
So your code is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mrrobot.mycoolweather" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name=".activity.ChooseAreaActivity"
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>
Although the question is kind of outdated, I would add the following to all the given answers:
For multi-module projects check carefully that you modify the Manifest corresponding to the Configuration you are trying to run.
Had the same problem and spent 20 minutes just to discover that I was trying to run wrong configuration (with an Application in ModulbeB, while thinking that I was running one from ModuleA).
And sometimes you are working on other module default runnable module changes so you have to change it.
Sometimes it is solved just restarting Android Studio
I had the "Default Activity not found" problem a couple of times and I could solved restarting my android Studio.
If you see that error occur after upgrading your IDEA, upgrading Android Studio version, or Generating a new APK, you may need to refresh the IDE's cache.
File -> Invalidate Caches / Restart...
In your manifest file there was wrong element name (Activity change to activity) declared
<Activity android:name="com.example.mrrobot.mycoolweather.activity.ChooseAreaActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</Activity>
Change it to:
<activity android:name="com.example.mrrobot.mycoolweather.activity.ChooseAreaActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
When I upgraded Android Studio to 2021.1.1.23 somehow my Run Configuration was switched from app to models, producing this error. Switching back to app resolved the issue for me.
i had these issues with my project:
Default activity not found
xml intellisense was not working
kotlin standard functions were not detecting
All my above issues were resolved by Deleting System cache of Android Studio 3.3 at the home path, and it's working nicely for me,,
Steps:
exit Android Studio
Go to path > C:\Users\YOUR_WINDOW_USER_NAME.AndroidStudio3.3\system
Then you have a \caches folder, delete this caches folder
Now open Android Studio and load your project
Worked for me.. i wasted couple of hours resolving this issue and finally it got resolved in this way.
Exit your android studio IDE. Then locate the "caches" folder in .AndroidStudio3.2 folder.
Location
C:\Users\YOUR_USERNAME\.AndroidStudio3.2\system\caches
For example.
Let's assume say YOUR_USERNAME is called Admin.
C:\Users\Admin\.AndroidStudio3.2\system\caches
Delete the caches folder and start your android studio IDE.
I have tried solutions here and other questions
clean & rebuild & invalidate and restart
make sure that activity has LAUNCHER as category
delete Android cache folder
at End, activity tag was has <activity android:name="com.exmaple.todo.MainActivity" />
when i changed it to <activity android:name=".MainActivity" /> app worked.
I hope it help you if other solution not work.
If your activity is in a different module (e.g. ':library) und you forgot to specify the subproject in the dependencies{} scriptblock of your :app module,
the manifest of :library and therefore the activities it declares, are not imported.
dependencies {
api project (':library')
You may check whether all activities show up in your app-debug.apk by using the following Android Studio menu command:
->Build->Analyze APK->app-debug.apk
Now open the AndroidManifest.xml and check its activity declarations.
I got this error in android 12+ after changing launch activity adding intent-filter but not make it exported.
so not forget.
android:exported="true"
It is likely that the action is not in the manifest.
This is the fix
Attached is an image
My main activity was not declared in Android Manifest File. That's the reason which came that error. This error come because of a declaration problem of Android Manifest file. Please check it. :D
This happened to me aswell took me ages to figure out why, but a weird bug I spotted is that if you run the app with breakpoints in your code without debugging mode it will cause this error to happen.
Quick fix for now: Only use breakpoints for degbugging mode.
Check your duplicate initialize activity in your AndroidManifest.xml
Like bellow:
<activity android:name=".nim.qiaqia.lota.LotaProduct"/>
<activity android:name=".nim.qiaqia.lota.LotaOrderDetail"/>
<activity android:name=".nim.qiaqia.main.activity.RechargeListLotaActivity"/>
<activity android:name=".nim.qiaqia.lota.MiningCoinLota"/>
<activity android:name=".nim.qiaqia.lota.LotaOrderDetail"/>
that can causes ""Default Activity not found" also. So, remove it and see. its works! :)
In my case android manifest was correct. I tried to invalidate Caches and restart but not worked. Then Rebuild project and it also did not work.
Then I realized that last night I added a new library to build Gradle, it was this:
implementation 'com.yalantis:eqwaves:1.0.1' And after removing this everything worked fine.
TIP: "Always have a track of things you do in your project, otherwise you will end up wasting your time"
If you only enabled building the app via app bundle, then this error might also occure when you try installing it as a default APK. Change the deployment option to APK from App Bundle and you are good to go.

Overwriting windowSoftInputMode preference in Visual Studio Tools for Apache Cordova config.xml file

I'm facing an issue in which the Android soft keyboard is appearing over the last edittext field on the page. Suggested solutions include changing the windowSoftInputMode, so I added the following preference in the config.xml file:
<preference name="android-windowSoftInputMode" value="adjustResize|stateHidden" />
However, after I do my build, the AndroidManifest.cordova.xml file in the release folder always has a windowSoftInputMode of "adjustResize" and thus nothing changes when I run the app.
<application android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/activity_name" android:launchMode="singleTop" android:name="CordovaApp" android:theme="#android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Does anyone know if this setting can be overridden and if so, what the mechanism is for doing so? I'm using Visual Studio (2013 Update 4) Tools for Apache Cordova CTP3.
I've had a similar issues in the past, here's how i solved it.
Create a custom AndroidManifest.xml file in the res\native\android folder. All the info in this file will get copied to the debug folder (and will overwrite what is contained in the config.xml file) when you do a build for Android Platform.
Here's a link to the MSDN documentation which has alot more info about custom configurations for the different platforms:
https://msdn.microsoft.com/en-us/library/dn757053.aspx

Android Studio Development - Even the default app won't work -

I have decided to try to learn some Android App Development however I am unable to follow even the most basic tutorial. My problem is that what ever I seem to do, the compiler complains about about the Manifest.
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]
However, this happens when the project is completely unchanged from when Android Studio created it.
The Manifest is below which is also unchanged but is copied below any way.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Toby.projecttoolkit" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Home"
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>
Can somebody shed some light on why this might be happening? Any help in this area would be really appreciated.
Many thanks
Toby
I had a similar issue, and I resolved it by changing the package name to begin with a lowercas later i.e use toby.projecttoolkit instead of Toby.projecttoolkit.
Apart from that the Manifest file looks fine.
Refactor the package, clean, refresh and build the project. Make sure your project as no errors and try to run it.

Default activity not created in Manifest file with Eclipse Juno

there maybe duplicate of this but I can't find any solution working for me.
I have downloaded latest Eclipse Juno from developer.android.com day before yesterday and it seems to act weirdly. I am trying to run "Hello World" but it is not creating default Activity in Manifest file.
Then I am also getting this error :
Unable to write Jarlist cache file
workspace\appcompat_v7\bin\jarlist.cacheworkspace\appcompat_v7\bin\jarlist.cache
Can someone please suggest
Add this code in your Manifest.
<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>

Phonegap facebook plugin errors - cordova cannot be resolved

I have tried everything to get the phonegap facebook plugin working on android, but to no avail. I am using cordova 3.0. I have followed the instructions at: https://github.com/Raffaello/phonegap-facebook-plugin/blob/master/README.md
So the application tag in AndroidManifest.xml looks like:
<application android:icon="#drawable/icon" android:label="#string/app_name"
android:hardwareAccelerated="true"
android:debuggable="true">
<activity android:name="face_login" android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.LoginActivity"
android:label="#string/app_name" />
</application>
The bottom of the config.xml file looks like:
<plugins>
<plugin name="org.apache.cordova.facebook.Connect" value="org.apache.cordova.facebook.ConnectPlugin" />
</plugins>
</widget>
However, I get a huge amount of errors, such as:
CallbackContext cannot be resolved to a type ConnectPlugin.java
cordova cannot be resolved ConnectPlugin.java
error: No resource identifier found for attribute 'hardwareAccelerated' in package 'android' AndroidManifest.xml
PluginResult cannot be resolved to a type ConnectPlugin.java
The import org.apache.cordova.api cannot be resolved ConnectPlugin.java
webView cannot be resolved or is not a field ConnectPlugin.java
I have included the cordova-3.0.0.jar in the buildpath. But still getting all these errors. Any idea's?
That plugin hasn't been updated in 6 months so it probably will not run on Cordova 3.x stream without some modification.
Try it on a Cordova 2.9 to see it it works?
Or you can go through the platform upgrade docs and try to upgrade it yourself to 3.0. Unfortunately there is not a plugin upgrade guide but there should be.
You could also try to use the Network Graph page of Github (I clicked the Fork button) and see if maybe somebody has already ported the plugin to 3.X.
Edit: Looks like there is a fork here that has been updated for 3.0. I have no idea how well it works but I'm sure the author would love pull requests if anything is wrong!

Categories

Resources