I am trying to generate allure report for android tests, but when I run command .\gradlew clean test, only testcases in test folder are there in the report. there are no tests from androidTest package. is there something wrong in the command or the build.gradle file. I am new to this, not able to figure it out.
I am using Android studio. Attaching build.gradle script.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "io.qameta.allure.gradle.allure:allure-plugin:2.11.2"
}
}
plugins {
id 'com.android.application'
id "io.qameta.allure" version "2.11.2"
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.tabbedactivity"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "io.qameta.allure.espresso.AllureAndroidRunner
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'org.seleniumhq.selenium:selenium-java:4.4.0'
implementation 'io.github.bonigarcia:webdrivermanager:5.3.0'
implementation 'io.qameta.allure:allure-junit4:2.19.0'
}
tasks.withType(Test) {
exclude '**/calltest/Summary.class'
}
Attached the copy of build.gradle file.
Related
When I add adomb library to my project apps stop working without showing any errurs on android studio. See here.
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.ozayd.azkar"
minSdk 23
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
It's maybe conflict version between your app and admob.
try upgrade admob version :
//with appcompat & material:
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.gms:play-services-ads:21.0.0'
implementation 'com.google.android.play:core:1.10.3'
then sync project again.
If it don't work, try add resolutionStrategy in gradle file:
android {
defaultConfig {
configurations.all {
resolutionStrategy {
force 'androidx.appcompat:appcompat:1.5.1'
force 'com.google.android.material:material:1.6.1'
}
}
}
}
then clean project and re sync
I have a project that has an app, and a module that is a library. Both have native c++ code compiled with Cmake.
The app works fine, with all four of the native .so libraries compiling and showing up in the .apk file, but the module is being compiled (it has a .so file in \build\intermediates\cmake\debug\obj), but the .so is not being moved into the .apk with the rest of the libraries. This gives me a java.lang.UnsatisfiedLinkError when I try to run any module code from the app.
Do any of you have any idea what I need to fix for the build to package the .so file from the module?
app build.gradle
plugins {
id 'com.android.application'
}
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdk 32
defaultConfig {
applicationId "com.example.nyota"
minSdk 24
targetSdk 32
versionCode 2
versionName '1.0.1'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ''
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version '3.10.2'
}
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation project(path: ':JavaRTP')
def nav_version = "2.4.1"
def acraVersion = '5.8.4'
implementation "ch.acra:acra-mail:$acraVersion"
implementation "ch.acra:acra-toast:$acraVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Java language implementation
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
// Feature module Support
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
// Testing Navigation
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
// Jetpack Compose Integration
implementation "androidx.navigation:navigation-compose:$nav_version"
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "androidx.core:core-ktx:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
}
module library build.gradle:
plugins {
id 'com.android.library'
}
android {
compileSdk 32
defaultConfig {
minSdk 24
targetSdk 32
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
externalNativeBuild {
cmake {
cppFlags ''
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version '3.10.2'
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
My Java class:
package com.active.javartp;
public class RTPPacket {
static {
System.loadLibrary("javartp");
}
public RTPPacket(long handle) {
nativeHandle = handle;
}
public RTPPacket(byte[] data, int size) {
nativeHandle = nativeConstructor(data, size);
}
private native long nativeConstructor(byte[] data, int size);
private long nativeHandle;
}
You need to call loadLibrary in your Java code to load the .so file. Until you do that, the library is unavailable. You also need to make sure the signatures of your Java native functions and the C JNI functions line up properly. Failure to do either will lead to that error. Which you didn't do I can't tell, as you didn't post your C or Java side code.
I would like to import pattern library of python.
The build gradle (app) is like below.
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.chaquo.python'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.chaquopy"
python{
pip{
install "pattern"
}
}
sourceSets{
main{
python{
srcDirs = ["src/main/python"]
}
}
}
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
// Here is local python.exe folder.
python{
buildPython "C:/Users/xxxx/AppData/Local/Programs/Python/Python38/python.exe"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Sync task finished successfully,
but it failed when I build the project, because of the failure to install mysqlclient.
Can I import pattern library using Chaquopy?
I'll appreciate your help.
It looks like Pattern doesn't actually require mysqlclient: in fact, it defaults to using SQLite. So you can modify it to remove the requirement:
Download the sdist from https://pypi.org/project/Pattern/#files.
Extract it.
Edit Pattern-3.6/setup.py to remove the "mysqlclient" requirement.
Create a .zip or .tar.gz file from the modified Pattern-3.6 directory.
Install this file by its filename, as shown in the Chaquopy documentation.
I am getting the following error in the Android Studio when "Gradle sync" is on action:
Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.30/kotlin-stdlib-jdk8-1.4.30.pom'. Received status code 403 from server: Forbidden
Disable Gradle 'offline mode' and sync project
It downloads few files then stuck on the same filekotlin-stdlib-jdk8-1.4.30.pom and show the error above.
I have tried several solutions like here and here and none of them realy solve the problem.
And since I am only using Java why the Android studio should care about kotlin ,is there any thing i can do to avoid dealing with Kotlin?
this is the gradle>build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
//classpath "com.android.tools.build:gradle:4.1.3"
classpath 'com.android.tools.build:gradle:+'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is the app>src>build.gradle file:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.myapplication_10"
minSdkVersion 29
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.google.gms:google-services:4.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
403 Forbidden usually means you're connecting from a country under US sanctions (Iran for example). Try to clean project, clear Gradle cache, quit android studio, connect to a VPN to change the IP of your computer, open studio and sync/run. Also some services like Shecan or Begzar might help.
I am building an Android library using maven.
Works fine, I can import the jars into an normal Android Studio Project, everything working fine.
However, when I try to build a Unity project using the exact same jars, I get following error: File 'META-INF/LICENSE' exists in both
So maven is creating those files in both jars.
I did not found anything on how to tell maven to only copy it into one jar, or in none.
Anyone an idea how to fix that problem?
Cheers
You can use with Custom Gradle.
Android build setting
Custom Gradle file
buildscript {
repositories {**ARTIFACTORYREPOSITORY**
google()
jcenter()
maven {
url "maven url"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
**BUILD_SCRIPT_DEPS**}
}
allprojects {
repositories {**ARTIFACTORYREPOSITORY**
google()
jcenter()
flatDir {
dirs 'libs'
}
maven {
url "maven url"
}
}
}
apply plugin: 'com.android.application'
**APPLY_PLUGINS**
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compileOnly files ('libs/unity-classes.jar')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
**DEPS**}
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}**SIGN**
buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
useProguard **PROGUARD_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
useProguard **PROGUARD_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
}
}**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
**EXTERNAL_SOURCES**
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**