aapt2 link failure: compileSdkVersion not found - aapt2

Trying to use aapt2 instead of aapt. Compilation seems to be OK, but I am having an issue:
+ aapt2 link -R build/mipmap-xhdpi_ic_launcher.png.flat -R build/values_public.arsc.flat -R build/mipmap-xxhdpi_ic_launcher.png.flat -R build/mipmap-hdpi_ic_launcher.png.flat -R build/mipmap-mdpi_ic_launcher.png.flat -R build/values_strings.arsc.flat -R build/mipmap-xxxhdpi_ic_launcher.png.flat --manifest AndroidManifest.xml -I /opt/android-sdk/platforms/android-26/android.jar -o javasrv2.apk --auto-add-overlay
AndroidManifest.xml:2: error: attribute android:compileSdkVersion not found.
error: failed processing manifest.
Here is the manifest, as you can see the attribute android:compileSdkVersion clearly defined:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.javasrv"
android:minSdkVersion="23"
android:compileSdkVersion="26"
android:targetSdkVersion="26"
android:versionCode="6"
android:versionName="1.0.0">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application xmlns:android="http://schemas.android.com/apk/res/android" android:icon="#mipmap/ic_launcher" android:label="#string/app_name">
<activity android:name="com.javasrv.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>
<service android:name=".MyTestService">
</service>
<service android:name=".MyJobService" android:permission="android.permission.BIND_JOB_SERVICE">
</service>
<receiver android:name="Boot">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application>
</manifest>
How can it be?
Edit: used xmllint on AndroidManifest.xml. No luck.
Then I just deleted android:compileSdkVersion from the manifest. It linked successfully. I am confused.

android:compileSdkVersion seems to be used only by gradle. In the AndroidManifest.xml itself tag uses-sdk should be used instead as specified in the documentation.

Related

flutter audio_service not working, errors in AndroidManifest.xml

I am attempting to recreate the audio_service tutorial on GitHub and it is not working, no sound is playing when you click the play button. I have observed an error in the AndroidManifest.xml which seems to be related - the documentation of course requires you add lines to the AndriodManifest.xml file.
However I am getting errors on the lines and which I suspect could be causing the problem. The errors are "Class referenced in the manifest, _______ , was not found in the project or the libraries / Unresolved package '___' " for both.
I did include these dependencies in my pubspec.yaml:
audio_service: ^0.15.1
just_audio: ^0.5.2
Note that I am having the same problem on both my Windows 10 development environment and on my MacBookPro running Catalina. Does anyone know how I can resolve this? What am I missing?
Here is my complete AndroidManifest.xml file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tv.realhelp.new_audio_service_test">
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="new_audio_service_test"
android:icon="#mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<service android:name="com.ryanheise.audioservice.AudioService">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>
<receiver android:name="com.ryanheise.audioservice.MediaButtonReceiver" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
</application>
</manifest>

unity setup firebase FCM plus Facebook for android

I have tried the messaging app from quickstart-unity-master and it was working fine on it's own but when I have added the Facebook plugin the following happened:
The firebase FCM is initializing successfully but I am no longer receiving the OnMessageReceived and OnTokenReceived.
It has probably something to do with the com.google.firebase.MessagingUnityPlayerActivity activity not receiving the events, but I am not sure what is wrong since the Android manifest is still the same after adding facebook.
I am using facebook 7.10.1
Here is my android manifest
<?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="${applicationId}" android:versionCode="1" android:versionName="1.0">
<application android:label="#string/app_name" android:icon="#drawable/app_icon">
<!-- The MessagingUnityPlayerActivity is a class that extends
UnityPlayerActivity to work around a known issue when receiving
notification data payloads in the background. -->
<activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:label="#string/app_name" android:icon="#drawable/app_icon" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
<activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
<activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
<activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
<activity android:name="com.facebook.unity.AppInviteDialogActivity" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb11111111111111" />
<provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider233093877143960" android:exported="true" />
</application>
</manifest>
appreciate your help
the issue was some missing dependencies, at first i only included what is needed by both SDK and tried them separately and they worked, but together didn't work for some reason;
the solution was to switch the build system from internal to gradle , then you don't have to worry about the max DEX methods and you can let the google play resolver download all the needed JAR and AAR;

Starting an Android service from a different package

I can't seem to start my android service when the service code is in another package that is not the same package as the MainActivity of the main app.
I have tried many many ways, even the AIDL method, and I can't get it to work at all.
MainActivity code
ServiceIntent.setComponent(new ComponentName("com.service.luna","com.service.luna.VService" ));
bindService(ServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
MainActivty Manifest
<?xml version="1.0" encoding="utf-8"?>
<!-- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" /> This is set from Gradle -->
<!-- Needed for camera passthrough -->
<!--<uses-permission android:name="android.permission.CAMERA" />-->
<!-- Needed to write thumbs -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Needed to for volume -->
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<!-- Needed for Google Play Services GPS -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.usb.host" />
<!-- Needed for uploading crash reports -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-feature android:glEsVersion="0x00030000" android:required="true" />
<application android:allowBackup="true" android:icon="#drawable/ic_launcher" android:label="#string/app_name"
android:hardwareAccelerated="true" android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen">
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only" />
<!-- singleTask launchMode because we never want multiple copies of the app running, -->
<!-- but we might want to internally spawn other activities -->
<!-- Theme.DeviceDefault.NoActionBar.Fullscreen gives solid black instead of a (bad stereoscopic) gradient on app transition -->
<activity android:name="com.main.luna.MainActivity"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
android:label="#string/app_name"
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:configChanges="screenSize|orientation|keyboardHidden|keyboard"
>
<!-- this filter lets the apk show up as a launchable icon -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="com.service.luna.VService" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.service.luna.VService" android:process=":VServiceRemote" android:exported="true" android:enabled="true">
<intent-filter>
<action android:name="com.service.luna.VService"/>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<receiver android:name="com.main.luna.ConnectivityChangeReceiver" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter>
</receiver>
</application>
Service Code
public class VService extends Service implements Serializable{
....
Service Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.service.luna">
<application
android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true">
</application>
When My code finally runs, I receive a
bindService callerProcessName:com.main.luna, calleePkgName: com.service.luna, action: null
Unable to start service Intent { pkg=com.service.luna cmp=com.service.luna/.VService } U=0: not found
The name of the main package is com.main.luna and the service is in package com.service.luna
If someone has solved this before, please let me know.
Try to enable the exported option in your manifest while adding your service ( android:exported="true")
<service android:enabled=["true" | "false"]
android:exported=["true" | "false"]
android:icon="drawable resource"
android:isolatedProcess=["true" | "false"]
android:label="string resource"
android:name="string"
android:permission="string"
android:process="string" >
. . .
</service>
and make sure you are using the Correct name of your Package name
Also check this post having similar situation
How do I start a service which is defined in a different package?

Android: permissions missing name and tags

I am quite new to Android programming and am attempting to create an app, but I wanted to make sure that I have everything correct and error free before I do. I have the following errors in my manifest file: missing name attribute in element ....and tag permission missing required attribute name. I thought I did have a name in permission ("#string/app_name") but the error is still there! here is a copy of the code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="s.p.cunningham.checkyournumberslotteryapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<permission android:name="#string/app_name"></permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="s.p.cunningham.checkyournumberslotteryapp.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>
</application>
Delete the whole tag. It is not a requirement in most of the cases, but god know's why comes as default when you create a new android application project.
If it isn't required, you can delete that tag... if you want to add any permission, then , delete that and use
<uses-permission
android:name="your permission....."
/>

Android Eclipse- Do I need a new Manifest file for each activity?

I have 1 manifest file set up right now that has this inside it
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.treacheryofimages.www"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.treacheryofimages.www.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=".OtherActivity"></activity>
<activity android:name=".OtherActivity2"></activity>
<activity android:name=".OtherActivity3"></activity>
<activity android:name=".OtherActivity4"></activity>
</application>
</manifest>
I want to create new buttons for my second activity page. So do I need to create a new manifest page for every activtity?
No, you don't create a second manifest. There is only one AndroidManifest.xml per project. I don't really see the relation that you are making between the buttons in an activity and the manifest file.
You should define your activities in the manifest file and leave your layouts in the
source/res/layout
folder, there you can use a layout file for each view for example
Here you can find the official Android documentation on how to structure your folders in your project.