Application not compatible with older Android versions - java

I'm generating an Android application via mvn -Pandroid gluonfx:build gluonfx:package. Here are the versions from the POM:
<maven-compiler-plugin-version>3.10.1</maven-compiler-plugin-version>
<maven-surefire-plugin-version>3.0.0-M6</maven-surefire-plugin-version>
<javafx-maven-plugin-version>0.0.8</javafx-maven-plugin-version>
<gluonfx-maven-plugin-version>1.0.14</gluonfx-maven-plugin-version>
<java-version>17</java-version>
<javafx-version>18.0.1</javafx-version>
<charm-version>6.1.0</charm-version>
<attach-version>4.0.15</attach-version>
Using graalvm-svm-java17-linux-gluon-22.1.0.1-Final
The application works well on Android 8. However, when trying to install it on Android 7.0, a message pops up saying that the application is not compatible with the device. I'm not sure where the default version is specified, but following the instructions, I copied the manifest file, which was
<?xml version='1.0'?>
<manifest xmlns:android='http://schemas.android.com/apk/res/android' package='my.app.demo' android:versionCode='1' android:versionName='1.0'>
<supports-screens android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application android:label='MyApp' android:icon="#mipmap/ic_launcher">
<activity android:name='com.gluonhq.helloandroid.MainActivity' android:configChanges="orientation|keyboardHidden">
<intent-filter>
<category android:name='android.intent.category.LAUNCHER'/>
<action android:name='android.intent.action.MAIN'/>
</intent-filter>
</activity>
<activity android:name='com.gluonhq.helloandroid.PermissionRequestActivity'/>
</application>
</manifest>
and added a line for supporting sdk 24 (matches Android 7.0):
...
<supports-screens android:xlargeScreens="true"/>
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="24"/>
<uses-permission android:name="android.permission.INTERNET"/>
...
Then I put it in my project under src/android/AndroidManifest.xml and ran mvn -Pandroid gluonfx:build gluonfx:package again. The APK was generated successfully, but upon installation the same error message appeared.
How do I install the app on Android 7.0?

As mentioned in the comments, the device uses an ARMv7 processor, which uses a 32bit architecture. GraalVM supports only 64 bits, so the APKs produced by it will work only on devices with 64bits, like those with ARMv8.

Related

java.io.FileNotFoundException: open failed: EACCES (Permission denied) for API >22

I'll keep it short as possible. Got an app working properly on all API level 22 devices and under, but with the new versions above 22 that had the new implementations of rules regarding permissions, I get this error message trying to fetch a file, stating it cannot be found because I don't have the right permission.
Naturally, before asking, I've did some googling and found that people make this problem go away by making the targetSdkVersion in the 'uses-sdk' AndroidManifest tag set to 22. I did so, even added permissions inside the manifest, but I'm still getting this error.
Here's the whole manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.packagename.appname">
<uses-sdk android:targetSdkVersion="22"></uses-sdk>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:name="android.hardware.camera.any"
android:required="true" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
So what's the deal here?
I should mention that the app works flawlessly on the API 22 device and I've checked, the path of the file is the same, so to my best knowledge, it's a permission issue.
Historically, targetSdkVersion was set via the <uses-sdk> element.
In Gradle-based Android app development, such as via Android Studio, the targetSdkVersion usually is set in the module's build.gradle file (e.g., app/build.gradle). The value set in Gradle overrides the value set in the manifest.
As a result, adding <uses-sdk> to a manifest may not appear to have any effect, simply because Gradle is overriding the values.

Chromium WebView does not exist

I am trying to create a Hello World app using Phonegap but it crashes when I call run the application on emulator. I followed the guideline here. Here is what I have on MainActivity.java :
package com.example.hello;
import android.os.Bundle;
import org.apache.cordova.*;
public class HelloWorld extends CordovaActivity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
// Set by <content src="index.html" /> in config.xml
super.loadUrl(Config.getStartUrl());
//super.loadUrl("file:///android_asset/www/index.html");
}
}
Here is my AndroidManifest.xml :
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.example.hello" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/app_name" android:launchMode="singleTop" android:name="HelloWorld" android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="20" />
</manifest>
Here is the first errors I get :
Chromium WebView does not exist
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.deneme/com.example.deneme.MainActivity}:
java.lang.UnsupportedOperationException
Can you tell me what is wrong with the application? Thanks.
Actually, not every Android phone ships with Chromium as WebView engine (https://developer.chrome.com/multidevice/webview/overview). For instance, my Samsung Galaxy Ace2 with Android 4.1.2 has old WebView engine. User agent string denotes some unknown Mozilla version, HTML5 apps look&feel and behavior differs from Chrome. However, PhoneGap apps do not raise errors on my phone.
I don't know why you're getting "Chromium WebView does not exist" error, but since you're on the very beginnig on your way (cause you're trying to build Hello World app using Phonegap) I want to point to another option. Using Crosswalk project allows you not to deal with various WebView engines on every android device but use embedded in your app chromium engine - always the same on every android device. The crosswalk project is available for android and tizen platforms. So to build crossplatform app (android an iOS) I would suggest to use either
Intel XDK, which can use single html5 source code with XDK api and Cordova api, that can be compiled to android app using crosswalk or compiled to iOS using native WebView.
Crosswalk+Cordova to build android app and PhoneGap to build iOS app from the same sources
This approach can eliminate pain on supporting various android devices.
See also:
http://html5hub.com/building-cordova-applications-with-crosswalk/
https://groups.google.com/forum/#!topic/phonegap/IxSuRUScbMs

Adb Transfer Protocol Error. No such file or directory

I tried to run my android app in a emulator using intelliJ 13, and I configured the emulator to be a Nexus 4 running android 4.4.2 with ARM cpu, and I got the follow errors:
Waiting for device.
"C:\Program Files (x86)\Android\android-sdk\tools\emulator.exe" -avd MyAVD0 -netspeed full -netdelay none
Device connected: emulator-5554
Device is online: emulator-5554
Target device: MyAVD0 [emulator-5554]
Uploading file
local path: C:\Users\daiyue\IdeaProjects\HelloDroid\out\production\HelloDroid\HelloDroid.apk
remote path: /data/local/tmp/com.example.HelloDroid
Adb Transfer Protocol Error.
No such file or directory
The following is my manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.HelloDroid"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19"/>
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<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>
</application>
</manifest>
The emulator showed nothing on screen as well, only when I pressed hardware button to switch on the emulator and only 'android' logo showed up and stayed forever.
I built the app using Android SDK 4.4.2 api.
So the work around is to delete the MyAVD0 in C:\Users\username\.android\avd, and recreate MyAVD0 again using Android AVD Manager.

parentActivityName not found in package android, despite using API 16 and support libs [duplicate]

I'm trying to complete this tutorial from the Android Page http://developer.android.com/training/basics/firstapp/starting-activity.html But I Eclipse throws this error: "No resource identifier found for attribute 'parentActivityName' in package 'android'" I have included the android-support-library.
Here is the whole AndroidManifest.xml code
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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="com.example.myfirstapp.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MainActivity" />
</activity>
</application>
android:parentActivityName appears first in Android 4.1 (API level 16). You need to have the latest 4.1 SDK to compile this.
To add to David Wasser's answer, if you use Eclipse and have the correct SDK library installed but still have this error, it means that while the correct library is installed Eclipse does not use it for this project.
To change that, go to your project's Properties (right-click on its name in the Package Explorer and it's the last but one option), select Android in the left hand column and you should have a list called Project Build Target. Then:
Select the appropriate target (Android 4.2.2 or Google APIs for Platform 4.2.2 in this instance)
Save your Manifest file (make a trivial edit if necessary)
Once it is saved Eclipse will process it and those errors should disappear as Eclipse finds the resource identifier in its new build target.
This error will also happen if you don't have the exact version of the SDK that the sample app uses as it's build target. Following the same steps as Julien describes above and choosing an SDK you have locally will fix it.
In IntelliJ IDEA, you need to change in Platform Settings->SDKs->Android something->Build target TO 4.1+.
If you don't see the option, you need an SDK version 4.1 or higher (API level 16+).

Android - "The server could not process your apk. Try again.." error when uploading on market

So this is my Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxxxxxxxxxxxxxxx"
android:versionCode="3"
android:versionName="1.02">
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<activity
android:name=".XXXXXXXXXActivity"
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=".XXXXXXXXXXXXXXXX"></activity>
</application>
</manifest>
Each time I upload to the android market, I get the error:
The server could not process your apk. Try again..
I previously uploaded a few APKs, but now I decided to downgrade my app, because it works on 2.1, previously it was on minimum 2.3. And since i've changed the minSdkVersion it doesn't want to upload anymore.
Looks like Android market is down. If you look carefully, you will see that upload does not even happen. So that error message is misleading you. Lets wait till Google resolves this.
#o2genum
I reported the problem here:
https://support.google.com/androidmarket/developer/bin/request.py?contact_type=bugs
(under "problems with the developer console")
And sent them the URL to this report
Edit:
Just saw this in the console:
22 February 2012: Application uploading and editing issues.
We are aware of issues with uploading and editing applications in the Android Market Developer Console. We apologize for this inconvenience and are working to fix this as soon as we can.

Categories

Resources