Location of espresso test reports into files created dynamically - android

Currently, all my test reports are being created and stored in the folder 'test-reports' in the project root directory. Below is the gradle file, in which I have specified the directory under 'testOptions'.
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.edk1kor.decodedemov3"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testOptions{
reportDir "$rootDir/test-reports"
}
}
I want to create a new folder, each time a test is run. Is it possible to dynamically create a folder each time? If not via gradle code, via the android source code?

Related

How to sync .so file with project in android studio?

I add .so file to app\src\main\jniLibs\libs directory as below:
app
...main
.......jniLibs
..............libs
..................armeabi
.........................libjsqlite.so
..................armeabi-v7a
.........................libjsqlite.so
..................x86
.........................libjsqlite.so
and after sync the project. But android studio doesn't know package from libjsqlite and couldn't import libraries to code. I tried different way at stackoverflow but I couldn't. Is there any useful way?
It's my project info:
compileSdk 31
defaultConfig {
applicationId "com.example.masterngo"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Thanks

Upgrading flutter android build tools

Flutter is building apk on android API level 29 by default I want to upgrade it to 30 how can I? I am new to flutter I don't know, I tried to google it but it wasn't helpful
Open a Flutter project in Android Studio and you have to edit the build.gradle file. In a flutter project, it is found at the path ./android/app/build.gradle
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.projectname"
minSdkVersion 19
targetSdkVersion 28 // Set this to 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Inspiration from this answer and modified accordingly

Android.Gradle: Autoincrement versionCode/versionName before create distributive

Android Studio 2.3.3, Gradle 4.2
My app/build.gradle snippet:
defaultConfig {
applicationId "com.myproject"
minSdkVersion 16
targetSdkVersion 23
versionCode 3
versionName "1.2.3"
}
My steps to create release distributive (apk):
Increment versionCode and versionName
Run, from console, command: gradlew assembleRelease
OK. It's work.
But I do not want manually increment versionCode/versionName before create distributive.
Is it possible to automate it? Or I need to write custom Gradle task?

NEW : the package conflicts with an existing package by the same name

I created two programs with a signature and two different names.
First app:
defaultConfig {
applicationId "ir.bitafaraz.dpnadpnaadmin"
minSdkVersion 17
targetSdkVersion 25
versionCode 3
versionName "1.0"
}
Second app:
defaultConfig {
applicationId "ir.bitafaraz.dpnadpna"
minSdkVersion 17
targetSdkVersion 25
versionCode 3
versionName "1.0"
}
My phone is Samsung(A5 2017, android 6.0.1).
I can not install both of them together.
I also tried with two different signatures.
Very interesting, I use the following library in both projects:
com.commonsware.cwac: provider: 0.4.3
Based on the link below:
https://github.com/commonsguy/cw-omnibus/tree/master/ContentProvider/V4FileProvider
When I deleted this library, my problem was solved.
EDIT:
The value of the AUTHORITY field is the same in both programs, their values must be different.

Android build flavor sqlite database

I'd like to create a demo from my application, so I tried to build another flavor, but if I try to run it, I get this exception:
attempt to write a readonly database (code 1032)
Original Gradle
defaultConfig {
minSdkVersion 9
targetSdkVersion 24
applicationId 'com.myapp.foo'
versionCode 518
versionName '4.3.2'
}
and this is my gradle with the two flavors
defaultConfig {
minSdkVersion 9
targetSdkVersion 24
}
productFlavors {
baz {
applicationId 'com.myapp.baz'
versionCode 1
versionName '1.0.0'
}
foo {
applicationId 'com.myapp.foo'
versionCode 518
versionName '4.3.2'
}
}
Are you sure you have your flavor specific source segmented correctly so that you only have one SQLiteOpenHelper? Meaning you have one under src/baz/java and one under src/foo/java but not one under src/main/java? Or just a single one under src/main/java?
In your AndroidManifest.xml provider section, it should be like the below one.
<provider
android:name="com.zoho.invoice.provider.ZInvoiceProvider"
android:authorities="${applicationId}"
android:writePermission="${applicationId}.permission.WRITE_SCHEDULE" />
So that the appropriate application id will be replaced while build process.
Also, in your whole project where ever, you use your application id, should be replace with the placeholder.
In your Java file, it can be accessed as
BuildConfig.APPLICATION_ID

Categories

Resources