how to push additional required files to the app directory? - android

I am new to Android Development , I was googling for this answer , but a lot of things are just how to upload music and stuff to your device.
Some information
I have a an app that compiles to c++ which will run on the device when I push it with gradlew installDebug . The problem is that I want to add some dependencies that are rather large making about 1G in file space.
I noticed that I cannot write at all to the /data/app/app-name directory when I tried to use adb push files.
Is there a way to have them moved to there during the install or how should this be handled? Keep in mind my app is written in C++ and used the ndk-builder to crosscompile .
In short:
Ideally, I would like the user to have the ability to just have all the files he needs when the application is installed. How can/should I do this?

So the answer is you can add files to your /data/app/res/ folder upon install , but it has to be small I think less than 100MB.
You can just user permission tag to the manafest and store the data in /sdcard/Yourcreatedfolder then access it like any other directory in C.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pvallet.com.github.hello_sdl2">
<application
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
>
<activity
android:name=".HelloSDL2Activity"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateVisible|adjustResize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

Related

How to install different versions of your own Android app on your phone without deleting the previous one

I would like to install different versions of an App on my phone by using Android Studio and I always changed the app name in the Android Manuscript. However, when I install the new version, the old version automatically gets deleted without Android asking me if I want to delete it and altough the name of the apps are not the same. Do you have any idea, how I can have multiple versions of the same app (with different names) installed on my phone without changing the name of the whole project?
Here is my Android Manuscipt:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.drinkserver">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="app_name_3"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I changed the label android:label="app_name_3" all the time but still, the old apps get deleted.
Reminder: Does anyone have an idea how to do this?

Android SDK Sensoro sensor Services not available

I am trying to add the Sensoro Smart Beacon -4AA android SDK to my android application.
The instruction on their official page Sensoro Development show that I should download SDK folder and put it in libs folder, I added them as shown in the screenshot. Then add the following services to my Manifest file :
<service android:name="com.sensoro.beacon.kit.BeaconProcessService"/>
<service android:name="com.sensoro.beacon.kit.BeaconService"/>
<service android:name="com.sensoro.beacon.kit.IntentProcessorService"/>
But the application can't detect the services and I searched for files with the names of the services but I didn't find them.
I think the services files should be available in the SDK folder but I can't find them. Is that correct or I am missing something
this is the manifest file code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="project.college.qmeup">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.Qmeup"
android:usesCleartextTraffic="true">
<service android:name="com.sensoro.beacon.kit.BeaconProcessService"/>
<service android:name="com.sensoro.beacon.kit.BeaconService"/>
<service android:name="com.sensoro.beacon.kit.IntentProcessorService"/>
<activity android:name=".Admin"></activity>
<activity android:name=".Usermain" />
<activity android:name=".Login" />
<activity android:name=".Registeration" />
<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>
To add jar files to an Android Studio project you typically do two things:
Put the jar files in the app/libs folder
Modify your app/build.grade file to point to this folder
You shown putting the jars in the root /libs folder (not under app) and do not mention adding the reference to build.grade. See this answer for more info:
https://stackoverflow.com/a/25660223
Shameless plug: If you get totally stuck, you might want to try using my open source Android Beacon Library, which is easier to set up, has full documentation and good support. (It is so good that I even support other people’s libraries, too!)
https://altbeacon.github.io/android-beacon-library

Can't install APK correctly on device

I have built & sign my apk by Eclipse ADT as it is describes (export and sign by creating a new key). But it can't be install on real device while an errors occurs, such as "installer package error". I have no Android device & sent my apk to friends by email. I'm using AVD and everyth is fine with it. Any suggestions? Thanx guys.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.XXXX.YYYY"
android:versionCode="0"
android:versionName="0.9.2" android:installLocation="internalOnly">
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true"
android:permission="android.permission.INTERNET"
android:allowBackup="true">
<activity
android:name="com.XXXX.YYYY.ActivityMain"
android:label="#string/main_activity_title"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.XXXX.YYYY.ActivityDetails"
android:parentActivityName="com.XXXX.YYYY.ActivityMain"
android:excludeFromRecents="true"
android:configChanges="orientation|screenSize">
</activity>
</application></manifest>
UPD: apk installs good, but the error occurs if choose Open (see screenshot). After that app works fine. But on tablet if try open app it says "App deleted".
UPD2: add supporting API 4+ meta tag for the 2nd activity, but it takes no effect
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.XXXX.YYYY.ActivityMain" />
You probably need to make sure your device and your friend's devices can install apps that are not from the play store.
This is a feature you have to specifically set, or else apps that are outside the play store will not install.
Here is how to set it:
Open settings
Find the Security settings (Pre 4.0 it is under Applications)
Look for a setting that says Unknown sources, or non-market apps
Enable that setting
Everything should work after that!
Here is an article with pictures if you are still confused :)
Your example was missing the closing </manifest> and android:enabled. I'm not sure if the latter would prevent a device from fully installing it but the first one would.
I've also had issues using the full activity names in the past, so you may want to try using simplifying them to see if it helps.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.XXXX.YYYY"
android:versionCode="0"
android:versionName="0.9.2" android:installLocation="internalOnly">
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true"
android:allowBackup="true">
<activity
android:name=".ActivityMain"
android:label="#string/main_activity_title"
android:enabled="true"
android:permission="android.permission.INTERNET"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ActivityDetails"
android:parentActivityName=".ActivityMain"
android:excludeFromRecents="true"
android:configChanges="orientation|screenSize">
</activity>
</application>
</manifest>
Is "Unknown sources" option under "security" allowed on device?
My problem was a duplicate internet permission request on Manifest! When I remove that from activity app was run normally.

Two AndroidManifest.xml files, which one is relevant

I am learning to develop android apps from android site. As you can see here they talk about AndroidManifest.xml . My project seems to have two such files , with diffferent content.
One located at : workspace\MyFirstApp
Having contents
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:debuggable="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.myfirstapp.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>
ANother located at workspace\MyFirstApp\bin and having below contents , in addition to what the first file has
<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>
I am not sure why there are two AndroidManifest.xml . Also which one is my main one being used by my project?
This workspace\MyFirstApp\bin is automatically build on Build where as
workspace\MyFirstApp this is your projects Manifest which you can modify and alter this is you main Manifest
Note: *Bin* and Gen Contents are automatically generated You shall not bother about them you can check by Cleaning the project both got emptied and on Rebuilding or Running again Gen and Bin Contents are recreated
bin folder is automatically created when you run your application.You don't need to bother about that.The original Android manifest file is the one in your work space.You can make all possible changes there and when you run your application it will automatically reflect in your bin folder.

My apps will not install on device when downloaded from the Android Market

I am unable to install my app onto a device even when it is downloaded from the Android Market. How can this be possible? If it were signed incorrectly wouldn't the market not accept it? I have tried to install it by isolating various activities but none seem to work even when I reduce it to a simple hello world application. The app has a tab view, two being webviews [one includes a reload button] and one tab that allows a user to send an email to a submission page. Does anyone have any ideas as to what I am missing?
Thank you all very much in advance.
EDIT:
It's being downloaded on the LG Ally running 2.2.2 and my app runs fine on an 2.2 emulator. It is compiled with a min level of 4. Here is my AndroidManifest file
<?xml version="1.0" encoding="utf-8"?>
<application android:icon="#drawable/icon" android:label="#string/app_name" android:debuggable="false">
<activity android:name=".BrotipsTabs"
android:label="Brotips">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TabWidget"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".Random"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".Sub"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".BrotipsTabs" android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
<meta-data android:name="com.mobclix.APPLICATION_ID" android:value="<Key>"/>
<activity android:name="com.mobclix.android.sdk.MobclixBrowserActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar"/>
</application>
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
By not working I mean it refuses to install and claims it never did while an icon remains on the phone.
Do you have any previous versions of your app installed on your phone? If you have an apk that is signed with the debug signature (which eclipse uses when you push run) and try to install it from the market which is signed with an actual signature then it will fail due to the two signatures being different. The message that it shows you is different on different devices I've found. If you have any previous versions of your app installed you should uninstall them and try to install from the market again. You should be good to go.

Categories

Resources