I'm trying to combine the functionality of BasicAccessoryDemo with AndroidWebServer (basically a USB=>Electronics interface with a simple web host app)
My java knowledge is limited at the moment and I'm running into some issues.
I tried combining the code into one project, but couldn't get it to work. I've read about adding one project to the other as a library.
Tell the BasicAccessoryDemo it's a library
Tell AndroidWebServer to include the BasicAccessoryDemo library
If I try to call a BasicAccessoryDemo method inside AndroidWebServer, I get the error 'accessoryManager cannot be resolved'. Which looks like there's no real connection between the apps?
Tried adding the BasicAccessoryDemo AndroidManifest.xml info to the AndroidWebServer manifest, but doesn't make a difference. Am I missing something? Sorry if this is a noob question, I've been trying to get this to work for a week now.
If anyone could point me in the right direction, that would be terrific!
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.varma.android.aws"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-sdk android:targetSdkVersion="14" android:minSdkVersion="10"></uses-sdk>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:name="com.varma.android.aws.app.AWSApplication"
android:description="#string/app_desc" android:debuggable="true">
<activity
android:name="com.varma.android.aws.ui.AWSActivity"
android:label="#string/app_title">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.varma.android.aws.ui.AWSMessageActivity"
android:label="#string/message_title"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name="com.varma.android.aws.ui.AWSPreferenceActivity"
android:label="#string/preference_title">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<service android:name="com.varma.android.aws.service.HTTPService" />
<!-- this section from BasicAccessoryDemo -->
<activity
android:name="com.microchip.android.BasicAccessoryDemo.BasicAccessoryDemo"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
</intent-filter>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="#xml/accessory_filter" />
</activity>
<uses-library android:name="com.android.future.usb.accessory" />
</application>
Related
Why is this is happening? That's an code error from .xml or from Java?
That's my app, it is divided into 3 parts (every part is a layout that is also an App) and I don't know why]
This app is part of my project for college. Ive used my partners activity and then this error appeared right after the import.
Probably this error appeared because of the import. Im not sure about what I have to do now and Im really new at Android programming.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.carro.robo.mobile.ufj.approbo">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<application
android:allowBackup="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity
android:name=".MainBluetoothActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PairedDevices"
android:parentActivityName=".MainBluetoothActivity" >
</activity>
<activity
android:name=".DiscoveredDevices"
android:parentActivityName=".MainBluetoothActivity" >
</activity>
<activity android:name=".Tela_bemVindo">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".CriacaoQuestoes">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
That is my .xml code. Android Version: 19 (KitKat 4.4)
Your app can have more than 1 item in the launcher. Every Activity that has a launcher intent filter gets an entry in it. Yours has 3. If you don't want them to be in the launcher, remove the launcher intent filter from the ones you don't want to show up.
I have an apk. I need to change some sprites in the apk and the logo.
I first decompile the apk you send using: apktool.bat d -s -f "SRacer.apk"
Then I change the logos and the car sprite.
Then I rebuild apk using apktool.bat and parameter b.
Then I sign this apk using jarsigner and my keystore file
Then I use: zipalign.exe -v 4 SRacer.apk
I check the signing using jarsigner and it says its correct.
But then the admob ads don't work.
I checked the androidmanifest of the compiled apk and it has the configchanges and adactivity in the XML.
I don't know what is going wrong because instead of ads I see
"You must have AdActivity declared in AndroidManifest.xml with configChanges" but that activity is declared, I'm sure.
Here is the manifest (AFTER its compiled and signed):
<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="3" android:versionName="1.2" android:installLocation="auto" package="com.androidapps.sracer"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:theme="#style/AppTheme" android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<activity android:label="#string/app_name" android:name="com.androidapps.sracer.MainMenuActivity" android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.androidapps.sracer.LevelSelectActivity" android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.ALTERNATIVE" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.androidapps.sracer.RecordsMenuActivity" android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.ALTERNATIVE" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.androidapps.sracer.HelpMenuActivity" android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.ALTERNATIVE" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.androidapps.sracer.PreloaderActivity" android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.ALTERNATIVE" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.androidapps.sracer.GamePlayActivity" android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.ALTERNATIVE" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode" />
</application>
</manifest>
The problem that I see is, that You haven´t declared the complete attributes to the configChanges. Also, you need to set Your SDK Version maybe to a higher level, because older versions don´t support all attributes (if I am remeber correctly, it is API 13 needed). Your configChanges should look like this:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
The attributes are case sensitive, so be sure to set them correctly.
I have some intents to execute different activities, my problem is that when I run the app in the device, eclipse install it with the name of the last activity. For example:
We have, three activities: 1 - 2 - 3. The first is the main activity (1), it name is Noow but I have an Intent to another activity (3) to get the location and return the data to (1). The app installed is named as getLocation (3) and it must have the name of the (1).
This is the manifiest xml file. Could someone help me with this? Thanks
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="victor.martin.noow"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="16" />
<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_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="victor.martin.noow.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="victor.martin.noow.LoginScreen"
android:label="#string/title_activity_login_screen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="victor.martin.noow.MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="victor.martin.noow.getLocationActivity"
android:label="#string/getLocationActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This is happening because the SDK will use the name of the activity having the LAUNCHER property:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The simplest solution would be to delete the LoginScreenActivity label and set it programatically. In this case the label provided in the tag will be used.
First of all there has to be one activity set as main activity i.e launcher activity. What you have done is set all activities as main which is incorrect in all terms of programming logic.
The activity with
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
gets the by default name, and by convention in your case after reading your xml the last activity got default name.
I have exported an app with 3 activities (main, splash and another activity called "about") to an apk file. It works fine when tested on the emulator. After uploading to the Play Store and then downloading to my own phone, it installs fine on my phone. Good so far. However, the apk doesn't appear packaged - it's showing the separate activities and not starting with the splash screen as it did in the emulator. What could be the problem? It exported with no errors. When I was exporting, I gave the apk a name that was different than the package name in the manifest. Would this cause the problem? Here is the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.spinner"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AboutActivity"
android:label="#string/title_activity_about" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Thank you for looking.
This intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
tells Android launcher app to show icon associated with Activity this filter is attached to on its Launcher screen. When corresponding icon is tapped by user, launcher app starts that activity and your code is executed. You usually want one entry point in your application so edit your Manifest file and ensure only one Activity element uses it. In your case, I guess leave it for SplashActivity and remove from others. It should look like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.spinner"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
</activity>
<activity
android:name=".AboutActivity"
android:label="#string/title_activity_about" >
</activity>
</application>
</manifest>
I'd also get rid of android:label from <activity> elements (just leave for <application>)
I'm trying to put a widget and an app in the same apk.
Here's my manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.mywidget"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".settingsPage"
android:label="#string/app_name"
android:theme="#style/app_theme"
>
<intent-filter>
<action android:name="com.me.mywidget.SETTINGSPAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="MyWidgetProvider" android:label="My Widgets">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#layout/widget_info" />
</receiver>
<service android:name=".UpdateWidgetService"></service>
<activity android:name=".Test"></activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="7" />
</manifest>
How do I put an app and market in the same apk? I tried this and while it runs, the app does not show up in the app drawer.
Also, when I add android:name=".mywidgets" my widget crashes when I run it.
Also, I will be adding multiple sizes to the widget later on.
You need to add the intent filter for launcher to whichever activity you want to show in the launcher...
<category android:name="android.intent.category.LAUNCHER" />
So if .Test is your primary launching activity you would modify your manifest like below..
<activity android:name=".Test"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>