Where to find values-v11 & values-v14 in Android Studio Projects? - android

I'm developing an app that is compatible with froyo+ devices and I need to set a theme that is only compatible with API11+ devices but, I cannot fix this cause (obviously) because as soon as I set the Holo.Dark theme the editor gives me an error about its compatibility. I know that I need those (only one of them) folder and their style.xml files to fix this issue but Android Studio doesn't generate those folder. I am wondering if I need to create all those folders and styles.xml files to do the trick or if there is a real workaround to this?
The current files tree is this
├───res
│ ├───drawable-hdpi
│ ├───drawable-mdpi
│ ├───drawable-xhdpi
│ ├───drawable-xxhdpi
│ ├───layout
│ ├───menu
│ ├───values
│ ├───values-w820dp

If you are using Android studio, right click res in your project, then New->Android resource file, and select the resource type: Values, and you can select size, region and others properties at left side.

I have the same problem on Android Studio.
after I create new folder "values-v11", it doesn't show in Android Studio.
you should open this folder in Explore and add *.xml file to this folder then the *.xml file will show in Android Studio in the "values" folder

Related

Export .clang-format code style to Android Studio

Question: Is there a way to import .clang-format code style in Android Studio for native development?
Context:
Hello all,
I am currently working on a cross-platform C++ project, which also involves Android. We have multiple subprojects, including a platform-independent common code base.
The structure of the whole repository looks something like this:
.
├── .idea - Settings for CLion
├── .vscode - Settings for VS Code
├── app
│   ├── android - Full Android project generated by Android Studio
│   │   └── .idea - Settings for Android Studio
│   └── linux - Project for targeting hardware based on Linux
├── core - Platform-independent library with business logic etc.
└── .clang-format - Clang-format configuration file for the whole repository
As you can see, we can use a single .clang-format file for the whole repository regardless of the used IDE (both CLion and VS Code can be configured by this file). However, I couldn't find a way to force Android Studio to also use the style defined there. I should mention that the Android project includes native C++ code, which I want to format using the same code style.
I was thinking about multiple ways to achieve this, but none of them worked. I've tried:
Forcing CLion to use .clang-format and export IDEA XML settings – does not work, as the settings simply include a directive to enable clang-format support
Find a way to convert .clang-format to .editorconfig, which is supported by AS – couldn't find any tools for that, and not sure if the two specs overlap enough.
Look for some plugins, custom on save actions etc. – research in progress, nothing so far.
Does anyone have a working solution or some other ideas I may try?
Try to look into File > Settings > Language & Frameworks > C/C++ you will have ability to change if you want use internal android's studio clang-tidy or external one or clangd.
You can use Android Studio's External Tools to call the clang-format executable directly on the file you want to format.
It's not quite as integrated as the built-in formatter (e.g. "undo" will prompt you to reload from disk), but it gets the job done. After you create the tool, you can run it with CTRL+SHIFT+A then type "clang-format" (or w/e you chose to name it). You can also use Android Studio's Keymap to run the tool.
Either one will format the file currently focused in the editor.
The -style=file argument will tell clang-format to look for your .clang-format file in a parent directory of the file being formatted. The -i flag will tell clang-format to update the file in line (instead of printing to stdout). $FilePath$ is a substitution variable provided by External Tools and will be replaced by the file currently in focus.

AppCenter: build React-Native project which is 2 levels deep in Git

I'm setting up react-native build in AppCenter.
Everything works on test projects, but in a real repository I'm facing the following issue:
For best performance, the analysis is currently limited to four directory levels including the root of your repository.
(Quote from official docs)
My package.json is 2 levels deep (/folder1/folder2/package.json), so build.gradle is located 5 levels deep (/folder1/folder2/android/app/build.gradle).
So when I set up the build in AppCenter I'm able to specify the Project field (pointing to my package.json), but Build Variant combobox is empty.
Is there any solution for that? Can I specify Build Variant manually?
P.S. If I simply move the project one folder above - everything works fine. But I can't do that in my monorepository.
The workaround we are currently using: we created a separate repo with 1-level less nesting, and I'm copying my folder to another repo on each push (via TeamCity).
So, having a repo structure like this:
project
│───frontend
│ └───shared
│ └───web
│ └───react-native
│ │ package.json --> this is the folder we want to build in AppCenter
│ │ ...
│
└───backend
└── somefile.cs
We set up git-hooks to copy the frontend folder to another repo:
root
└───shared
└───web
└───react-native
│ package.json --> this is the folder we want to build in AppCenter
│ ...
So we got one level less deep repository which is ok for AppCenter.

Android Studio newly created folders not showing

I am using Android Studio 2.1.1 (currently the most updated stable version).
I created new directory inside 'res' by name "values-21"
and it don't shows up.
But if I go to the physical location of 'res' on the hard drive I can see that its exist.
and of course I checked using both Android and Project Files structure but either way its not showing it.
I wanted to check where is the problem so I created another directory by name "menu", and the last one was shown.
just to be sure I tried to create the same directory again ("values-21") but Android studio didn't allowed it because this directory allready exist's.
any ideas how to fix it?
Update - the solution is to create new directory using the "Android resource Directory" option and not by "Directory" option.
all you values xml files stored in values, values-21, values-mdpi or other physical folder in AndroidStudio displayed in one res/values folder.
It will not show until you copy a XML file into values-21, android studio consider all values folders to be of same family and it shows only one folder and the files with post script of the family in which it lies.
copy some layout file from resource directory and through windows explorer paste in that the folder that you have created i.e values-21 and now come back to android studio and check the folder should be there.
Happy coding

Adding an assets folder in Android Studio

Android Studio has changed its project structure yet again... now it is
project
└── app-module
├── manifests
├── res
└── java
I've been looking everywhere online, but I can't find where to put the assets folder. When I try to create the folder via the directory viewer in Android Studio (right-click, New... directory) the "directory" option is not available. The only available options are:
Java Class
File
Module
Package
Image Asset
None of which will do what I want here.
Has anyone figured this out?
An image of how to in Android Studio 1.5.1.
Within the "Android" project (see the drop-down in the topleft of my image), Right-click on the app...
You can click on the Project window, press Alt-Insert, and select Folder->Assets Folder. Android Studio will add it automatically to the correct location.
You are most likely looking at your Project with the new(ish) "Android View". Note that this is a view and not the actual folder structure on disk (which hasn't changed since the introduction of Gradle as the new build tool). You can switch to the old "Project View" by clicking on the word "Android" at the top of the Project window and selecting "Project".
According to new Gradle based build system. We have to put assets under main folder.
Or simply right click on your project and create it like
File > New > folder > assets Folder
To specify any additional asset folder I've used this with my Gradle. This adds moreAssets, a folder in the project root, to the assets.
android {
sourceSets {
main.assets.srcDirs += '../moreAssets'
}
}
right click on app-->select
New-->Select Folder-->then click on Assets Folder

Creating resource files for different build types on Android studio

So I upgraded to Android Studio 0.8.14 and I already know that I can create a new folder on my module app/src/newbuildtype and there I can create the folders java and res specific to my build type, but what I want is to create the resources from Android Studio directly. Is there a way to do this? What I want to avoid is to create folders directly with my file explorer, thanks.
So I found that I can create a app/debug/res folder by right-clicking on my module, selecting this options from menu New->Folder->Res Folder
After that you can create, let's say the values folder by right-clicking on my app module -> New->XML->Values folder and selecting my build type
And there you have created your values folder on debug build type, that now appears like this

Categories

Resources