fastlane supply android metadata has the following structure:
└── fastlane
└── metadata
└── android
├── en-US
│ └── changelogs
│ ├── 100000.txt
│ └── 100100.txt
└── fr-FR
└── changelogs
└── 100100.txt
Production builds and versions is changed some times before release so I had to change files names in changelog directories after every build.
I want to have only one "what's new" (changelog) file per locale for the latest build. Something like whats_new.txt
Does fastlane or supply provide such a feature?
supply is not set up to support such a strategy right now, sorry. I think it is a reasonable feature request though. Please submit an issue in our GitHub repository if it's something you'd like to see be possible!
A plugin like changelog might be what you are after. It allows you to pull from one changelog file like so:
read_changelog(
changelog_path: './custom_folder/CHANGELOG.md', # Specify path to CHANGELOG.md
section_identifier: '[Unreleased]', # Specify what section to read
excluded_markdown_elements: '["###"]' # Specify which markdown elements should be excluded
)
I do not, however, see builtin support for a per-locale changelog. For reference, the release_notes.txt file and/or function provide the functionality you describe when using fastlane for iOS projects.
I think what you want it's supported nowadays with the default.txt file
https://docs.fastlane.tools/actions/supply/#changelogs-whats-new
Related
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.
I'm creating a React-native app which I'll integrate into iOS/Android app(already created). Can you please suggest a good way of folder structure(especially React-Native).
I really like this way to structure an Project:
── app
├── components
├── config
├── index.js
├── lib
└── screens
More Information about this, you find here:
https://medium.com/the-react-native-log/organizing-a-react-native-project-9514dfadaa0
In past when building multi language apps in Android I used to place strings.xml in following tree:
res
├── values
│ └── strings.xml
└── values-es
└── strings.xml
Currently (according to tutorial) it should rather look like this:
res
├── values
│ └── strings.xml
└── values-b+es
└── strings.xml
Please note values-b+es instead of values-es. I couldn't find why it was changed and to me it looks worse than previously, so I wonder what is the reason of such change?
What's more freshly updated Android Studio still auto-generates those names in old way:
I couldn't find why it was changed
The old approach still works and is what most developers use, because that is the one that has decent documentation. Also, the new approach only works on certain API levels (due to the poor documentation, I forget when it was added).
I wonder what is the reason of such change?
AFAIK, the new approach employs a different naming scheme, which extends support to more language/region combinations.
I would like to add layout xml files into my androidTest folder to be used only for testing.
I added res/layout folder to androidTest and tried to add a layout file to it. But it gives error URI is not registered for xmlns:android="http://schemas.android.com/apk/res/android"
Somehow the project does not recognize it as valid layout file.
It is tricky to add xml resources to androidTest.
Android Instrumentation tests create another APK to run the tests against your original application. Although you can access your Context and objects from your main application, you cannot modify the generated APK file of your app.
That means you cannot put additional layout xml to your original application from tests that are in the androidTest folder.
Solution:
Alternatively,
you can create a buildType called espresso.
Then, create an espresso folder where you can put any java or Android resource you want to add.
You can even modify your AndroidManifest there.
Then, use testBuildType 'espresso'
Your build.gradle should look like this:
android {
testBuildType 'espresso'
buildTypes {
espresso.initWith(buildTypes.release)
}
}
dependencies {
espressoCompile 'somedependency' // you can even have special dependencies
}
When you run your espresso tests around that flavor, you will have an access to additional layout xml files you added.
Should look like this:
That's easy! In general, you should just put your resources under the src/androidTest/res folder. And that is! Then you can use it in your src/androidTest/java files. Yes, you can't use test layouts in your production APK, but you can use your test layouts in your test APK.
There're some problems that might confuse you. For instance autocompletion works well not so very often, but, anyway, it builds and works.
Recently I wrote custom control for masked EditText so I don't want to put any activity into the library, but I do want to have an activity to check the view and I do want inflate it from XML. You can see the whole code on the github page, here're some key moments:
$ tree androidTest/
androidTest/
├── AndroidManifest.xml
├── java
│ └── ru
│ └── egslava
│ └── lib_phone
│ ├── MainActivityTest.java
│ ├── TestActivity.java
│ └── actions
│ ├── HintViewAction.java
│ ├── KeepHintViewAction.java
│ └── SetTextViewAction.java
└── res
├── layout
│ └── activity_main.xml
└── values
└── styles.xml
So you can see, that under androidTest there's some kind of a separate project with its own manifest that registers Activity and so on :-) I would share more files, but it's just a project, no more and you always can look up the link.
The only thing that I'd like to warn you, that you should be ready that Android Studio will show you that your project contains errors even if that's not true :-) Good luck!
Cannot comment, but wanted to further add to #Slava's answer. If someone can add it as a comment, by all means.
Try suppressing the lint errors with the accepted answer from this question.
Android Studio Remove lint error
I am working on an OpenCV app, and it works fine but when I try to install the app it asks to download the OpenCV manager, and which i dont want. I want to make a stand alone installer for OpenCV app which includes the OpenCV manager inbuit into it ? I did check this link but still it shows pop up to install opencv?
in my experience you maybe just need to do these 2(or 3) steps:
1.change the load lib code in java like this:
static {
Log.i(TAG,"OpenCV library load!");
if (!OpenCVLoader.initDebug()) {
Log.i(TAG,"OpenCV load not successfully");
}
else {
System.loadLibrary("opencv_java");// load other libraries
}
}
2.delete this code in java:
OpenCVLoader.initAsync(OpenCVLoader.OpenCV_VERSION_2_4_3, this, mLoaderCallback);
3.if you have add ndk code to your project, maybe you have to edit Android.mk file like this:
OpenCV_CAMERA_MODULES:=on
OpenCV_INSTALL_MODULES:=on
OpenCV_LIB_TYPE:=SHARED
Solution
When you provide libopencv_java3.so with your APK the OpenCV loader doesn't need the OpenCV Manager
Simply copy the OpenCV libs folder (see Context below) into the folder containing your AndroidManifext.xml. Now rename this libs folder into jniLibs. The result should look like the structure below. Props to this post. There's also a bit more details.
android studio project/
├──libs/
| └── *.jar <-- if your library has jar files, they go here
├──src/
└── main/
├── AndroidManifest.xml
├── java/
└── jniLibs/
├── arm64-v8a/ <-- ARM 64bit
│ └── libopencv_java3.so
├── armeabi-v7a/ <-- ARM 32bit
│ └── libopencv_java3.so
├── x86/ <-- Intel 32bit
│ └── libopencv_java3.so
└── ...
└── libopencv_java3.so
Now build your APK file. Make sure the libraries are properly provided within your app. Here is your APK after building:
[project name]\[app name]\build\outputs\apk\debug
Just open your APK with a Zip program of your choice. The above listed *.so files should be listed in the APK here:
APK file/
├──lib/
| ├── arm64-v8a/
| │ └── libopencv_java3.so
| ├── armeabi-v7a/
| │ └── libopencv_java3.so
| ├── x86/
| │ └── libopencv_java3.so
| └── ...
| └── libopencv_java3.so
├─ ...
Using this APK should result in OpenCV no longer looking for the OpenCV Manager App. Of course your APK grows very large by providing the library for every ABI. Depending on your use case it might become useful to only provide the libraries for the targeted ABIs/platforms. It is possible to create filters for supported ABIs. In case the is relevant start reading here.
ENJOY!
Context
At runtime your application requires the OpenCV library file
libopencv_java3.so. This file comes in different versions depending on the target platform where you want to use it. Have a look at your local OpenCV SDK directory at this location:
[OpenCV SDK]\sdk\native\libs\
Here you'll find a short list of provided ABIs/platforms via providing the respective OpenCV library file:
armeabi
armeabi-v7a
x86
x86_64
arm64-v8a
Android OpenCV Manager
From what I understood the OpenCV Manager App does nothing else but provide the required OpenCV library to an app when called from:
if (!OpenCVLoader.initDebug()) {
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
} else {
Log.d(TAG, "OpenCV library found inside package. Using it!");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
This makes sense when you have multiple applications requiring the OpenCV libraries. So you would only store it a single time on your mobile device instead of as part of every app.
When you look up what OpenCVLoader.initDebug() does in the OpenCV sources you'll end up at this statement:
loadLibrary("opencv_java3")
So basically the OpenCVLoader tries to find the OpenCV library file within your APK before querying the OpenCV Manager.