I have a simple calculator app. It's a complete application all by itself.
I also have a more advanced calculator app that's based on the first app, but has more features. Its main Activity extends the first app's main Activity. The advanced app references quite a lot of resources and methods from the simpler app.
Getting the advanced app to build under Android Studio has been a nightmare. I've been googling and trying things blindly in the build.gradle files, but not making much progress. At first, the problem was dependent features configured but no package id was set (whatever that means, Google turned up no documentation.)
I got past that by tweaking the build.gradle files, and now I'm getting Manifest merger failed with multiple errors, see logs, but I can't find the relevant logs. It looks like the build failed because Android Studio tried to merge the AndroidManifest.xml files from the simple app and the advanced app, but I just wanted to use the manifest from the advanced app.
This is all very frustrating because I made it all work under Eclipse but now I have to move to Android Studio.
I guess my first question is: How can I tell Android Studio to just use the Android Manifest from the current project and not try to merge from the other project.
In general: can an application project serve as a library for another project, and if so how? Are there any examples?
Third question: where can I find good documentation on build.gradle?
I could attach my current build.gradle files and AndroidManifest.xml files if people need to see them, but I'm really hoping to learn enough that I can help myself.
Confirm the problem first:
Switch the same model in Library / application
Application ID androidmanifest conflict problem
if this is the problem, the official documents can see the channel packaging
https://developer.android.google.cn/studio/build
And I wrote you a little demo
https://github.com/yuanweiwork/lytools
I hope it can help you
Related
I am creating an app with two main flavors, calling it from now on FlavorA and FlavorB. Each of these flavors has different manifest files, and they have their own Activity (I am working with a single-activity strategy). I have read the following documentations.
App links
Deep linking
App link indexing, which has the most relation with what I have an issue with.
I use App Links Assistant from the Tools menu, and I am stuck in one of the steps (choosing activity). The issue is that Android Studio cannot find the activity that is not defined inside the default manifest file (the activity is defined inside FlavorA's manifest). As a result of this problem, I cannot go to the next step and get the assetlinks.json file. I have searched and have not found anything near my question so far. Am I missing a concept, or is there another way of solving this issue?
I have a project template , when i want to produce a unique application manually to update it to the market. I will follow these steps :
Right click in the package name
Refactor, then Rename
Renaming the package in minifest then update the version code
finally to clean the code from imports errors such as *.R; errors
My question is there any tool that automate this refactoring process without being involved on it ?
i tried to create a java tool but it consumes memory and some things i have to finalize it manually , i'm searching for this since 3 days and nothings gives you a clear answer.
My question is there any tool that automate this refactoring process without being involved on it ?
The new Gradle-based build system can handle this scenario. In fact, it allows you to separate the package name used by R.java (to keep it consistent) and the package name used for determining whether the app is unique on the device and in the Play Store.
I recommend that you watch "The New Android SDK Build System" video from the Google I|O 2013 conference to learn more about what it can do, as Xav definitely covers this scenario.
Note that while it is not a "right click", it should make scripting a solution fairly easy.
Thank you all, I've solved this problem by converting the template project into JAR and let another small project handle every thing , I've created a small method that updates the minifest in that small project and i had to update package,ver name and ver code ONLY ,then I've generated the APK using ANT ,however i tested the project and it works fine , hope this will help another people
I am working on an android group project in college and this is the first big project many of us have worked on.
We worked on implementing several pieces of the project as completely separate projects and now are having trouble putting all of them in one application with a main page.
On the main page of the application we would have a bunch of buttons that would then go to the implemented project that we've completed (example, I click on BMI calculator on the app homepage and it goes the the bmi calculator screen).
Any efficient way of going about this that can be explained in an easy to follow manner? I'm still a newbie programmer :)
Just to clarify, I don't want it so that it just launches a BMI calculator app from the main app, the entire code base is supposed to exist under one app.
Thanks
You can have a main project and several other projects declared as library projects.
In build time, library projects are pulled into the main project and only one apk will exist as the output.
The library projects are almost the same as an usual android project. You can have java packages, res folder, lib folder, etc.
Check here for the official description.
Check here for a tutorial.
Look into making the other applications as Android Library-projects, and listing all necessary components on your AndroidManifest.xml on your parent project.
Another way would just give the option for the user to install these applications as separate and have a logice (PackageManager) check if specific application exists or is installed and then enabling navigation buttons or disabling components and invoke them via Intents.
I am implementing menus using TWL (http://twl.l33tlabs.org/) in an app written using Libgdx. The app runs fine if I don't start any menus, but as soon as I go to a menu screen it immediately force-closes. Menu screens work fine on the desktop version.
In which build path should TWL-android.jar be included (right now it behaves the same in main, android, and both)? And how will the program know to use the libraries from this .jar instead of the default gdx-twl.jar? Will I have to manually implement something in code to use one or the other depending on platform?
There does not seem to be any documentation or sample code of anyone using TWL on android, only mentioning that it can be done.
Running debugger attached to phone gives the following logcat error:
Could not find class 'com.badlogic.gdt.twl.Layout' referenced from method com.Nanners.OptionsScreen.<init>
I think that TWL-android.jar should be added to android project's build path too. Location of .jar is not relevant.
When you add TWL-android.jar. As that is Android specific you can't use it on the core project, so the classes you are importing are the ones from gdx-twl. To make it simpler to explain I will divide it in different escenarios.
You add TWL-android to your Android buildpath. But you use Gdx-twl in your core project. Which isn't added. Thus getting a:
Could not find class 'com.badlogic.gdx.twl.Layout'
You add both TWL-android AND Gdx-twl to your build path. Thus getting duplicated classes and:
Conversion to Dalvik format failed with error 1
Solution
If you use TWL-android classes, you can only do it inside the Android project:
Merge Core, Desktop and Android project. Or
Use Interfacing with Platform Specific
If you use Gdx-twl:
Don't do it.
Actually the best solution is to get rid of all twl stuff and use Scene2d.Ui instead. Its crossplatform and much easier to use.
I am new to android...and i am trying to build an application that doesn't have AndroidManifest.xml but does contains files like .sh,.bat,.exe,etc. Along with folders ant-lib and lib containing .jar files...
Please help me as to how should i build such an android project from scratch
Please help
Obvious question: Why do you want to create an app without an AndroidManifest.xml? It's like creating a Java application without a main-method.
Maybe it helps if you give more details on what you're trying to do. For example, why do you want to include .bat and .exe files in your application? Remember that Android is based on a Linux plattform so I'm not really sure what you're trying to do here..
If you're new to Android do the following:
Read the application fundamentals: http://developer.android.com/guide/topics/fundamentals.html
Create a Hello World app: http://developer.android.com/guide/tutorials/hello-world.html
Browse the API Demos application and learn from the code: http://developer.android.com/resources/samples/ApiDemos/index.html
Having an Android app without a manifest.xml file is totally nonsense. This is how Android works. It needs the manifest to be able to understand what kind of permission your app has, what kind of Activities (UI) it provides etc... You basically cannot have an application without an manifest file.
What you want is a library not an application. As all application in android must have manifest.xml but libraries dont. The DataExtractionOSM in that project is a library just like any java library.
Check out the following Create library for Android development?