When generating signed bundle or APK I need to choose one way or the other. But I wish to create both in single build, release settings for aab and debug for APK. Is it possible?
Use the Bundle tool to generate apk from app bundle. Download BundleTool.
First, generate app bundle then use this bundle to convert it into apk by running below command
java -jar F:\Android\AndroidStudioProjects\bundle-tools\bundletool-all-1.3.0.jar build-apks --bundle=F:\Android\AndroidStudioProjects\bundle-tools\app-debug.aab --output=F:\Android\AndroidStudioProjects\bundle-tools\app-debug.apks --mode=UNIVERSAL
Replace path to your file path of bundle, bundletool and output file path
Related
I have created a sample app https://github.com/ajithvallabai/TestMethod in Visual studio 2019 . I want to run prebuild and build scripts in package.json https://github.com/ajithvallabai/TestMethod/blob/master/TestMethod/package.json#L10-L11 when we build the solution . Is there any way to do it ?
(In this app there is no build-events option in Project>properties
This method is only working for "buid" command https://learn.microsoft.com/en-us/visualstudio/javascript/compile-typescript-code-npm?view=vs-2022 that too it needs additonal files like .ts files .tcx files . but i want to run custom commands.
You can give answer for VS19/VS22 also
I want to build an APK of release build variant of my app in android studio.
The steps which I follow to build an APK file are as follows:
Build > Generate signed bundle / apk
Android app bundle
Selected key store and added required password for keystore and key
Selected build variant as release
Error:
Execution failed for task ':app:packageReleaseBundle'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Unrecognized native architecture for directory 'lib/arm'.
I solved this error by updating my app-level build.gradle file.
Added following lines:
defaultConfig {
....
....
ndk {
abiFilters 'arm64-v8a', 'x86_64', 'x86', 'armeabi-v7a'
}
}
And it solved my build issue.
If there comes some issue While generating APK ,then again generate APK but not with existing path ,choose create new path.You can generate your app APK either in debug or release mode or You can choose both.Then generate APK ,it will surely work.
I have declared versionName 1.1.8 in gradle file
AS generates apk file under the outputs folder, say MyApp-1.1.8-release
But when AS install the apk, it uses a path named with MyApp-1.1.0-release
I can not search the words "1.1.0" in the whole project
I don't know where AS find the wrong version name
Can we config app name in AS?
Clean the project, sync Gradle, then re-run the app.
But it didn't work last Saturday. Actually, the root cause didn't be found
I need to use rapidjson as a third party library to replace libjson. I'm trying to figure out how to build it so I can use it's build files in my project (dependency list).
I downloaded rapidjson from github, and I'm trying to get a buildable project. I'm looking at the instructions at rapidjson website, and it's showing that I need to do the following, below (Installation).
We don't use git, so what would I need to do instead of the git submodule update --init step?
Why would I need a build dir in the include/rapidjson directory with nothing in it?
When I cd to build and type cmake, it seems to be missing parameters. What is the full cmake command? Thanks!
Installation
RapidJSON is a header-only C++ library. Just copy the include/rapidjson folder to system or project's include path.
RapidJSON uses following software as its dependencies:
•CMake as a general build tool
•(optional)Doxygen to build documentation
•(optional)googletest for unit and performance testing
To generate user documentation and run tests please proceed with the steps below:
1.Execute git submodule update --init to get the files of thirdparty submodules (google test).
2.Create directory called build in rapidjson source directory.
3.Change to build directory and run cmake .. command to configure your build. Windows users can do the same with cmake-gui application.
4.On Windows, build the solution found in the build directory. On Linux, run make from the build directory.
On successfull build you will find compiled test and example binaries in bin directory. The generated documentation will be available in doc/html directory of the build tree. To run tests after finished build please run make test or ctest from your build tree. You can get detailed output using ctest -V command.
It is possible to install library system-wide by running make install command from the build tree with administrative privileges. This will install all files according to system preferences. Once RapidJSON is installed, it is possible to use it from other CMake projects by adding find_package(RapidJSON) line to your CMakeLists.txt.
It is header-only library. So if you just want to integrate it into your project, just copy the /include folder to your project, and it should works.
All other instructions are for building unit tests, performance tests and documentation.
I was using ANT before (Android Project) and i had "static" files in the same packages as my code
Here is an example
src/com/my/app/test/Parser.java
src/com/my/app/test/json_to_parse.json
When executing the unit tests, the json file was copied into the gen folder, therfor it was possible to access the json in the test with
getClass().getResourceAsStream(fileName)
I had to convert the project to gradle, but now the tests are failing.
After checking the "build" folder, i've realised, the .json files are not there, therefor the getResourceAsStream method returns null.
Any idea how to include these "static" files (json, xml, ...) into the build folder?
Moving the files into the resources folder did not work out of the box in Android Studio (even though is should have)
This should be fixed in Android Studio 1.2.
However, this is what i did:
Moved all static files into the resources folder.
In my unit-test module i've added this to the build.gradle file
task copyTestResources(type: Copy) {
from "${projectDir}/src/test/resources"
into "${buildDir}/classes/test"
}
processTestResources.dependsOn copyTestResources
Now, all files located inside src/test/resources will be copied into /classes/test where i can access them with
getClass().getResourceAsStream(fileName)
If i keep the package structure inside the resources folder the same as it was in the java folder, i don't need to adjust any code.
To complete the story a bit more:
JUnit4 runner requires
getClass().getResourceAsStream(name)
while Robolectric requires
getClass().getClassLoader().getResourceAsStream(name)
The files you are asking about are called "resource files" in Maven/Gradle lingo.
Gradle assumes that you are using the Maven Standard Directory Layout.
So, either you move your files into src/test/resources (then Gradle will pick them up automatically), or you tell Gradle that it should look for resources in some other place.
In the latter case, you need to modify the processTestResources task. However, keeping resource files in the same directory as source code is a bad practice. So I advise the former option.
if your problem is happen when you create apk with AndroidStudio.
you can create a jar file that includes your resources with jar.exe
for example i put a.txt into resources directory
and run this code in cmd:
"C:\Program Files\Java\jdk1.7.0_79\bin\jar" cvfe res.jar -c resources
after that a jar file "res.jar" was created
then add that res.jar into libs folder in your project
when your apk is creating resources are added to your final apk and you can use this code to acsess a.txt:
someclass.class.getClassLoader().getResourceAsStream("resources/a.txt");
with this job no need to change Gradle setting.