Prepare Android App for Previous SDK Versions - android

I have built an Android App using Android Studio and I've been doing testing with a tablet running Android version 5.1.1 (API 22). Once the development was finished I tried using the APK to install the same app to an S7 running Android 8.0.0 (API 26). The app crashed while running on the S7, but runs flawlessly on the tablet. The target SDK version for the app I built is API 29 and the minimum SDK version is API 22.
I can change the compile SDK version from 29 to 28 and I don't get any build errors. However, changing it to 27 gives me the following errors:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
C:\Users\xxxxx\.gradle\caches\transforms-2\files-2.1\9073307f5eb1fdd8dc5b08ac4a3a252e\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
C:\Users\xxxxx\Desktop\appDev\app_green\myApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.
C:\Users\xxxxx\.gradle\caches\transforms-2\files-2.1\11ac981ad78c9fd8730f98006e1b2a23\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\xxxxx\.gradle\caches\transforms-2\files-2.1\11ac981ad78c9fd8730f98006e1b2a23\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.
I figured if I decreased the API level one by one and fixed any errors that popped up, I'd eventually end up with an app that would work on all the desired APIs. Is this a correct assumption?
How do I go about fixing errors like this one that fail to link Gradle resources? This one seems to be an error with a dialog box that I used to get user input.
All solutions to these errors that I find are "change API version," but what if I need this API version?
Edit:
At the request of those attempting to help me solve this issue I am posting the crash log from the S7.
Process: com.myApp, PID: 15167
android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/myApp/files/export_a_c.csv exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
at android.net.Uri.checkFileUriExposed(Uri.java:2356)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:944)
at android.content.Intent.prepareToLeaveProcess(Intent.java:10480)
at android.content.Intent.prepareToLeaveProcess(Intent.java:10486)
at android.content.Intent.prepareToLeaveProcess(Intent.java:10465)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1616)
at android.app.Activity.startActivityForResult(Activity.java:4564)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:767)
at android.app.Activity.startActivityForResult(Activity.java:4522)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:754)
at com.example.myApp.SecondActivity$onCreate$3$3.onClick(SecondActivity.kt:218)
at android.view.View.performClick(View.java:6897)
at android.widget.TextView.performClick(TextView.java:12693)
at android.view.View$PerformClick.run(View.java:26101)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
The error occurs when I try to create/write to a csv file. The intent is to create this file automatically and then prompt the user to share it via email.
Edit 2:
So I've fixed the crash issue while running on the S7. How do I ensure that the app will run for each API? Must I downgrade my S7's software to the APIs I want to test?

You will need to setup a File provider in the app. https://developer.android.com/training/secure-file-sharing/setup-sharing

Remove declaration for compile.sdk from your manifest and build.gradle.
You should keep the min and build SDK version declarations only.

Related

Trying to TestFlight my Unity Game on Google play Store. Everything uploads but when it goes for review, it fails and it gives be stability error

Error Detected on 1 device during testing
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.apps.messaging/com.google.android.apps.messaging.ui.conversationlist.ShareIntentActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f08014a
More info about this..... This expands this..
FATAL EXCEPTION: main
Process: com.google.android.apps.messaging, PID: 26814
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.apps.messaging/com.google.android.apps.messaging.ui.conversationlist.ShareIntentActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f08014a
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2805)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2883)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1613)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f08014a
at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:229)
at android.content.res.Resources.getDrawableForDensity(Resources.java:876)
at android.content.res.Resources.getDrawable(Resources.java:819)
at android.content.Context.getDrawable(Context.java:605)
at ym.a(PG:15)
at com.google.android.apps.messaging.ui.common.ListEmptyView.a(PG:5)
at nog.c(PG:20)
at cy.b(PG:48)
at nol.b(PG:15)
at android.support.v4.app.Fragment.g(PG:120)
at em.f(PG:71)
at ee.a(PG:447)
at ee.c(PG:436)
at ee.d(PG:395)
at ee.a(PG:427)
at ee.b(PG:327)
at ee.a(PG:535)
at ee.c(PG:217)
at ee.c(PG:109)
at ee.i(PG:61)
at di.onStart(PG:114)
at ma.onStart(PG:128)
at vit.onStart(PG:60)
at lkx.onStart(PG:33)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1334)
at android.app.Activity.performStart(Activity.java:7033)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2768)
... 9 more
Error Detected on 1 device during testing
Fatal AndroidRuntime Exception detected.
Error Detected on 1 device during testing
Native crash of com.Tom.Fireg
4 issues on Android 9 (SDK 28)
I don't know how to fix this, please help me. I got my TestFlight running on AppleStore but it crashes when I play too much so I am trying to fix that. However, on Google PlayStore, I can't even upload due to these errors. Help me please. When I click on android stimulator to run on my unity platform it works fine, just uploading it gives me errors.
I followed this YouTube video how to upload on google playstore. I changed Scripting Backend to IL2CPP in order to enable ARM64. ARMv7 was automatically selected. Just changed Scripting backend and enabled ARM64. Made a key manager to create a key and selected release under Minify. Create symbols.zip on video it said to choose enable. However, I had these options, disabled, public, or debugging. I choose publish since this released map and zip to use on google play. I don't think I did anything wrong here but help me out, please.
Check the packages you have included in the project. They probably weren't included in the Android Manifest.
Android uses the file called Android Manifest within your app to define some basic information.
Among the information he seeks are dependences.
For example if you have implemented a function to send a notification, it will need to be included in the Manifest file.
If there are no dependencies, the app will crash.
Try exporting your game to Android Studio and running it from there. It should show you all the problems.

Android resource linking failed ( error: failed linking references.)

After i add GDPR code to my app in (MainActivity.java) seccion , After i try to rebuild project i get this error :
Android resource linking failed
C:\Users\jalal\Desktop\codecanyon-20549858-fast-cleaner-battery-saver-with-admob-ads\Main File\Fast Cleaner & Battery Saver\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
C:\Users\jalal\Desktop\codecanyon-20549858-fast-cleaner-battery-saver-with-admob-ads\Main File\Fast Cleaner & Battery Saver\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
C:\Users\jalal\Desktop\codecanyon-20549858-fast-cleaner-battery-saver-with-admob-ads\Main File\Fast Cleaner & Battery Saver\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
error: failed linking references.
I already checked her and i don't found any solution , Thank you
Look at the error reported:
values-v26.xml:7: error: resource android:attr/colorError not found
This one (and the next few) are all because these android attributes were only added in API 26 (that's why they're referenced from values-v26). You need to update your compileSdkVersion to at least 26, although I'd highly recommend updating to the newest API 28.
Edit your app level's build.gradle file:
android {
compileSdkVersion 28
...
}

Installation apk in android 8.0 error

I have benn trying for many days to install an app on any device using android oreo either in debug mode with android studio either by creating apk, but I still fail. At the beggining I had issue described here install_failed_no_matching_abis failed to extract native libraries res=-113 after updating to android 8.0 oreo
and while I am trying to solve this I get different errors all the time.
When I set android.enableAapt2=true I get this error
when I set android.enableAapt2=false I get warning
The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
I`t will be removed at the end of 2018..`
and finally this error comes up
and this in log Mesagges
04-17 01:37:27.331 9763-11258/? E/xiy: Job(ItemMessageAttachmentsCacheEvictorJob#0.126) Enqueued job 'ItemMessageAttachmentsCacheEvictorJob' failed
java.lang.IllegalArgumentException: Attachment cache cannot be null.
at piu.a(Unknown Source:4)
at pki.a(Unknown Source:17)
at yik.a(SourceFile:1)
at xik.b(SourceFile:2)
at xil.a(Unknown Source:4)
at yik.a(SourceFile:1)
at yhr.run(SourceFile:1)
at wzc.run(Unknown Source:3)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:782)
Either way I cannot install my app on any device running oreo although it works fine up to nougat.Even if I buld apk ig get error parsing apk file.

Error when trying to install Instant App

I've a multi feature app.
Installed App version works perfectly.
n
Instant App version was working till yesterday. Now I can build it correctly but I get this error when trying to install any of the instant modules.
Does anyone have the same issue ?
I cannot understand the error message:
Failed to finalize session : INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed parse during installPackageLI: Failed to read manifest from /data/app/vmdl138992238.tmp/base.apk: For input string: "otb"
I do not have any otb string.
otb is a the name of a feature module, but not the one I'm tring to install
EDIT:
I tried to rename the module otb to ootb. I got the same error having it "For input string: "ootb""
also I retrieved the logcat stacktrace:
07-01 01:51:37.516 776-817/? W/PackageManager: Failed parse during installPackageLI
android.content.pm.PackageParser$PackageParserException: Failed to read manifest from /data/app/vmdl1025494079.tmp/base.apk
at android.content.pm.PackageParser.parseBaseApk(PackageParser.java:1252)
at android.content.pm.PackageParser.parseClusterPackage(PackageParser.java:1133)
at android.content.pm.PackageParser.parsePackage(PackageParser.java:952)
at android.content.pm.PackageParser.parsePackage(PackageParser.java:966)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:16828)
at com.android.server.pm.PackageManagerService.installPackageTracedLI(PackageManagerService.java:16767)
at com.android.server.pm.PackageManagerService.-wrap29(Unknown Source:0)
at com.android.server.pm.PackageManagerService$7.run(PackageManagerService.java:14255)
at android.os.Handler.handleCallback(Handler.java:769)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Caused by: java.lang.NumberFormatException: For input string: "ootb"
at java.lang.Integer.parseInt(Integer.java:608)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:133)
at android.content.res.TypedArray.getInt(TypedArray.java:373)
at android.content.pm.PackageParser.parseActivity(PackageParser.java:4184)
at android.content.pm.PackageParser.parseBaseApplication(PackageParser.java:3612)
at android.content.pm.PackageParser.parseBaseApkCommon(PackageParser.java:2103)
at android.content.pm.PackageParser.parseBaseApk(PackageParser.java:1984)
at android.content.pm.PackageParser.parseBaseApk(PackageParser.java:1236)
at android.content.pm.PackageParser.parseClusterPackage(PackageParser.java:1133) 
at android.content.pm.PackageParser.parsePackage(PackageParser.java:952) 
at android.content.pm.PackageParser.parsePackage(PackageParser.java:966) 
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:16828) 
at com.android.server.pm.PackageManagerService.installPackageTracedLI(PackageManagerService.java:16767) 
at com.android.server.pm.PackageManagerService.-wrap29(Unknown Source:0) 
at com.android.server.pm.PackageManagerService$7.run(PackageManagerService.java:14255) 
at android.os.Handler.handleCallback(Handler.java:769) 
at android.os.Handler.dispatchMessage(Handler.java:98) 
at android.os.Looper.loop(Looper.java:164) 
at android.os.HandlerThread.run(HandlerThread.java:65) 
at com.android.server.ServiceThread.run(ServiceThread.java:46) 
Ok I maybe found the source of the problem for anyone having the same issue.
This may be related to android O SDK (API 26).
Compiling and targeting API 26 works correctly for classical app but is giving this error for instant apps at install time.
Rolling back to compile SDK 25 solved the problem in my case.
I'll wait for the final API/gradle plugin before tryng again.

Gradle Error for Android Studio

I'm trying out Android Studio on OS X and am running into a mysterious error message. I went through the Google guide to building a simple UI, but when I finished writing the XML file and hit Run in the IDE, I get the following message ("Test2" is the name of the project):
Gradle: Execution failed for task ':Test2:validateDebugSigning'.
> Could not find matching constructor for: org.gradle.tooling.BuildException(java.lang.String)
I have never developed an android app before, so I don't know how common this is. I did a search for this error and found no one encountering the same problem.
I tried the solution from Abhan and I get a new error message:
Error: org.jetbrains.plugins.gradle.settings.GradleSettings cannot be cast to org.jetbrains.plugins.gradle.settings.GradleSettings
It warns you that android plug-in task validateDebugSigning cannot access the debug key. Check your accessibility to the debug.keystore.
On linux or OS X, the default location is ~/.android. On windows, it's in C:\Documents and Settings\.android\ or C:\Users\.android.

Categories

Resources