Delphi XE5 release version of Android app -- Internet disabled - android

I can create an app with Delphi XE5 (update 2, hotfix 1 -- but same was true in Update 1) that runs when it is created as a DEBUG version. But when I create it as a RELEASE-APPLICATION STORE version Internet stops working.
It seems to overwrite the android.manifest.xml file and take the INTERNET setting out of it. I have tried various ways of manually updating the file and deploying. But you have to run BUILD again to get the change to get incorporated -- and that overwrites the file again.
The app is simple app using REST. Also has a browser, with URL set in another part. Works fine in DEBUG version. In RELEASE-APPLICATION STORE version on REST call it says SOCKET #13 error, also web page does not work. So definitely no INTERNET.
Any thoughts, order for doing the manual change, or ideas would be greatly appreciated.
FOLLOW-UP --- FOUND THE SOLUTION
Unfortunately user permission settings are not not working completely in my environment. I change the INTERNET setting to TRUE in PROJECT | OPTIONS | USER PERMISSIONS and compile/build and the INTERNET setting gets eliminated (overwritten) from the AndroidManifest.xml file created in the project \release folder. In \debug version it is there (INTERNET setting) and is fine.
Solution for me, at least, is to update the AndroidManifest.template.xml file and add the INTERNET setting there -- so it is copied to both \release and \debug versions of the AndroidManifest.xml files.
So my AndroidManifest.Template.xml file .. in the project root looks like this:
... header and other info
<uses-permission android:name="android.permission.INTERNET" />
... other stuff and footer for file
The template files is used to create the \release and \debug versions of the AndroidManifest.xml files so it forces that setting to be put in that file.
This worked and cleared up the socket 13 error I was getting, and no INTERNET access on the release Android versions. YAY!!!

You have to go into the Project Options and enable the INTERNET permission. It is enabled by default for Debug builds, and disabled by default for Release builds.

I had the same problem. And setting project settings have no effect on release version. I think it is some kind of bug, because that effect appears only with INTERNET option. My solution is to set this option manually in androidManifest.template. In that case, it is working fine.

I put mine in after ..uses-permission... and it worked fine.

Related

I want to disable android.permission.ACCESS_BACKGROUND_LOCATION in my Xamarin app

I want to disable android.permission.ACCESS_BACKGROUND_LOCATION in my Xamarin app because I dont need it anymore but when I uncheck the checkbox in the Properties tab:
And delete the permission request in the android.manifest file itself:
The permission request still seems to be there according to the manifest file from the archived .aab file and also according to the google play dev console.
I also searched my entire solution and dident find any other references.
Is there anything that causes this request or anything I forgot to delete?
Check the merged AndroidManifest.xml in obj\Release\nnn\.
If it is there, then something in your build process has added it.
If it is not there, then add to your question more details about how you build and launch to google play dev console - what you are seeing at dev console should match what is in the obj version of that file.
It was defined in the AssemblyInfo.cs and after removing it there everything was fixed.

After Compile In Android Studio My APK Contents Are Dated 1980?

Hello i have a rather small issue but in a small way its a massive issue as googleplay keep rejecting my app because of it.
Here is my issue:
Screenshot the my apk contents
So all the files in my apk after compiling with a newly created keystore (or without and unsigned) are date at 1980 as in the picture above. my androidmanifest.xml is also the same?
This is really annoying i have tried timestamping methods here on stackoverflow without any success.
I have been throught the whole project in android studio for any related configuration in settings and code. i have re-installed android studio jkd,ndk,sdk and still its the same.
Anit help on solving this issue would be greatly appreciated.
Thank You
This is intentional, it reduces changes between apks.
If you want to avoid this you can add the following setting to your gradle.properties file:
android.keepTimestampsInApk = true
According to my tests it will change only some of the timestamps (e.g. classes.dex) in the apk and keep some of the timestamps (e.g. AndroidManifest.xml).
source: https://issuetracker.google.com/issues/37116029

Firebase working without permission.INTERNET... How?

My firebase application is running perfectly on my android device without having added the permission.INTERNET flag. I installed Firebase directly from gradle. I am aware that adding Firebase through the project structure window in android studio will add the permissions.INTERNET for you. But this is not the case, my Android manifest has nothing in regards to permission.INTERNET yet is still fully functional...
I havent been able to find any info on this... Is this because its now run by Google?
The documentation for manifest merging states:
During the build process, the manifest merge process stores a record
of each merge transaction in the
manifest-merger-{productFlavor}-report.txt file in the module
build/outputs/logs folder. A different log file is generated for each
of the module's build variants.
You can look there for a detailed explanation of which library is providing the permission.
Or since you are using Android Studio, you can use Ctrl-Shift-N and type "AndroidManifest.xml" to see a dropdown menu of all the manifests in your build and open them to see what they contain.
A feature was added to Android Studio 2.2 to show the results of manifest merging. When viewing the manifest in an Editor window, select the Merged Manifest tab at the bottom of the window to see the contributors to the manifest.
In my build, which includes a number of Firebase libraries, the manifest that adds the INTERNET permission appears to be:
com.google.firebase\firebase-analytics\9.4.0\AndroidManifest.xml
I was manually managing my Mobile Data's permissions and I discover that, if I block mobile data on "Google Backup Transport", I cannot connect to Firebase.
I really think this is the reason You can use Your app even without INTERNET permissions.

How to download a file from FTP and store it locally with Cordova?

I'm struggling for some days to do that. Without success.
I've found two ways that I think reasonably to follow:
1: Plugin cordova-sftp-plugin.
I see that it is writted to deal with 'secure ftp', but why wouldn't work in an ordinary non secure ftp? Nothing was metioned about it.
I've tried so, applying the 'Use Example' from the official page, the code fells in the success callback function, but when I list the local directory, nothing was changed! It gives me no clue about what goes wrong! In true, the software does not detect nothing wrong.
Before the previous steps, I did not forget to precautionally install and enable the 'cordova-plugin-file', 'cordova-plugin-file-transfer' and 'cordova-plugin-network-information' and to add the <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> in the AndroidManifest.xml. Tryied to save files in cordova.file.externalRootDirectory and cordova.file.externalRootDirectory + "/Downloads/. Nothing worked.
2. The macdonst FtpClient plugin.
Searching for my issue, one of the first pages that appears is How to ftp a file over to a server from PhoneGap/webapp?, and beyond some further search I've found another one in a relatively old post mentioned the successful use this plugin in a Cordova application. So I can consider this plugin as a stable choice.
The problem with this method comes earlier: I coundn't even build the application after a manual installation proccess. May it is a problem in the manual installation proccess.
The official plugin documentation teachs to install it in a PhoneGap application, and not a Cordova. The steps was not replicable to Cordova, due to some differences in paths and configuration, and some others links also supports the plugin installation solely in Phonegap, not Cordova.
I also tryied follow the steps in the http://antonylees.blogspot.com.br/2015/01/how-to-manually-add-cordova-plugins-to.html and Manually install Device plugin (and others) into cordova 3.0 to manually add the plugin. The steps in the first link also was not well replicable, and although the second one are more straitfoward, also does not solved the issue.
Building it gives me a java error compilation. The first error output (what uses to cause all the following errors are):
E:\danilo\Documentos\projetos_cordova\ftpDownload3\platforms\android\src\com\phonegap\plugins\ftpclient\FtpClient.java:27:
error: package org.apache.cordova.api does not exist
import org.apache.cordova.api.CallbackContext;
Very strange. May I have to search for the org.apache.cordova.api jar file and put in the lib folder? Also, I did not forget to put the commons-net-2.2.jar in the project libs folder.
Can anyone have some suggestion to succeed this? I just want to download a file through ftp protocol and save locally and so, if there's an alternative method to succeed, it will be appreciated too.
Thanks in advance.

unable to instantiate application - ClassNotFoundException

EDIT: This problem has not already been resolved in the other suggested SO question
I had a fully working app on the market for over a year, with very few crash reports. Then recently I changed my app into a library, so that it could be included within multiple different "wrapper" projects. This was so that I could easily make different version - free, paid, non-google markets, with/without in-app purchasing etc etc.
The new "library+wrapper" app appeared to work fine. I could run it multiple times, without error. But then a day later (when presumably the OS had closed some or all of the app's activities) I tried to run it and it reported
Unable to instantiate application com.mycompany.mygamelibrary.MyGameApplicationClass: java.lang.ClassNotFoundException: com.mycompany.mygamelibrary.MyGameApplicationClass
The class it failed to find is the first class that runs when the program starts up, MyGameApplicationClass - which extends Application. This class is part of the library.
I suspect something goofy in one of the two manifest files.
The manifest of the wrapper project contains the lines...
<application android:icon="#drawable/mygame_icon"
android:screenOrientation="portrait" android:label="My Game Name"
android:name="com.mycompany.mygamelibrary.MyGameApplicationClass">
Any ideas what could have gone wrong?
EDIT: The library was referenced "the correct way" as defined by yorkw's answer to this SO question.
EDIT: I can not repeat the crash at the moment :-( I don't know what it is the OS does when the app is not used for a day or two.
There are two possibilities. Either you, like me, have a spelling error in your manifest file. Have a co-worker or friend read it to make sure the name is correct. Or you have not referenced the project correctly.
The official document describes how to properly link projects in its documentation.
Why it would first seem to work and later stop working is a bit of a mystery. However, I guess that the VM might still have had the necessary references ready to resolve the classes in the library just fine. A restart of the VM removed all those references and trying to resolve them was unsuccessful.
Update: Regarding the edits in the OP: As you confirm that you have correctly referenced the other project, you can check if the project is included in APK, just to be sure. You can rename and open an APK as any other archive (.rar works fine for me). Sometimes, it happened to me, the project is not correctly included in the APK. A cleaning of your workspace usually remedies the problem and so could a restart of your IDE depending on what you are using. To manually conduct a clean in Eclipse for example, use Project->Clean... or try Android Tools->Fix Project Properties by right-clicking on your project.
As you seem to also have fixed the problem by restarting your device, it could be that the libraries were linked incorrectly. A problem that I have never seen myself but as a very common quote says: "Have you tried turning it off and on again?".
For Android Studio:
Build --> Clean Project
Fixed issue.
Have you tried to make a new subclass of MyGameApplicationClass in your 'main' project and set it in the manifest as Application class?
I had a slew of bugs with Android Studio 3.0 Canary 4 and the way I fixed them was by editing the AndroidManifest.xml by adding in some jibberish to the application name. Then, I clicked build. Obviously, a whole mess of new error messages appeared. I changed the name back to what it should be, built the app, and it just ran.
Sometimes, I just don't know...
EDIT: Just ran into this issue on Android Studio 3.0 Canary 4 on my laptop when switching over. I again went through the same process of changing AndroidManifest.xml file to contain a typo, building, and changing back. That didn't work.
I then noticed that instant run was still enabled. Going into settings (by clicking command + , (comma key)) and typing "instant run", I was able to disable instant run, built the app, and the error of class not found went away.
Summary of Steps to Fix [FOR ME]
Invalidate cache / restart
Clean the project
Manually delete the build folder (need to be in project view for this one)
Make an intentionally errant edit to your AndroidManifest.xml file, build the app, observe the errors, remove the errant edit and build again
Disable instant run
Again, I don't mean to insinuate that this will fix everyone's error, but I have now used some combination of these steps on two different machines (MacOS Sierra) and it has been resolved for me. Hope it helps.
In my case, application id and package were mismatched. This should be same as presented in following images...
AndroidManifest.xml
app/build.gradle
In this case you can see, applicationId and package both are same that is com.mycompany.mygamelibrary
May be its a Build Path Configuration problem.I did the following to solve the issue.
1.Right click on your project and go to Java Build Path.
2.Click on Order and Export tab.
3.Check Android Private Libraries and other 3rd part libraries if you have added.
4.Press ok and clean the project.
I hope it will solve the issue.
Once I had the same error message, but maybe the cause isn't the same.
I did a code and worked for a while, then I wanted to improve it and got the same error and I couldn't run it.
I could fix the problem with
the correct Build Path order (as I can see you've already did this)
I check on the Order and Export tab the android-suppor-v4.jar
and the key was the Android SDK Managert->Upgrade everything and (next) Eclipse->Help->Check for updates.
After I upgraded to the latest android plugin and SDK my app compiled and ran again.
I hope this will help you!
I'm not very sure about this but it might be that your system's debug.keystore license validity has expired as it is valid for only 365 days. You just need to delete the debug.keystore from your computer. The debug.keystore will be generated automatically by Eclipse when you compile your Android App.
Same message seen ... this time it turned out to be different output folders for MyApp/gen and MyApp/src in the Build Path (caused by Maven integration).
Unchecking "Allow output folders for source folders" solved the problem.
I had this issue in an Android application that needed an Application class which was created in wrong path inside the Android Studio project. When I moved the class file to the correct package, it was fixed.
This all Process work for me to solve application class Exception.
Step 1: Open Run(window+R) Search -> Prefetch Remove all file (Some file not Delete)
Step 2: Open Run(window+R) Search -> %temp% Remove all file (Some File not Delete)
Step 3: Open Android Studio -> Build -> Clean Project
OR
Select File > Invalidate Caches / Restart > Invalidate and Restart from Android Studio toolbar.
OR
Close and reopen Android project.
OR
Restart System
I ran into this issue several times and both times it seemed to be caused by some instant run feature.
In my case, deleting the application from the device and then installing it from Android Studio again resolved the issue.
I ran into this problem today. The project runs well for over a year but today it reports this issue, and cannot debug on my testing device.
I fixed it by updating to latest gradle version. Hope this can solve your problem.

Categories

Resources