after adding this
implementation'com.cepheuen.elegant-number-button:lib:1.0.2'
getting the error every time i add this dependency
Manifest merger failed : Attribute application#theme value=(#style/Theme.AppCompat.Light.NoActionBar) from AndroidManifest.xml:13:9-65
is also present at [com.cepheuen.elegant-number-button:lib:1.0.2] AndroidManifest.xml:16:9-40 value=(#style/AppTheme).
Suggestion: add 'tools:replace="android:theme"' to <application> element at AndroidManifest.xml:7:5-27:19 to override.
which other dependency can be used for elegant button
build.gradle module app file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.sharma.digimenu"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
implementation 'com.firebaseui:firebase-ui-storage:4.0.0'
implementation 'com.firebaseui:firebase-ui-database:4.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation'com.cepheuen.elegant-number-button:lib:1.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
Do the following changes in Manifest.xml
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
xmlns:tools="http://schemas.android.com/tools"
tools:replace="android:theme"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Home"
android:label="#string/title_activity_home"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity android:name=".FoodList"></activity>
</application>
Follow the instruction, add tools:replace="android:theme" to your <application> element.
Related
I want to include Bottom Navigation Menu in my project but it is not working. The menu icons are not showing in Bottom Navigation Menu. I am using Android Studio Arctic Fox. I did all the steps correctly but still facing issue. Here is my code please help me solving this issue. Thanks.
Main Activity Xml
`<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_nav"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#8603A9F4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="#menu/bottom_nav_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
res\ menu\ bottom_nav_menu
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/home"
android:icon="#drawable/ic_home"
android:title="Home" />
<item
android:id="#+id/orders"
android:icon="#drawable/ic_notes"
android:title="Order" />
<item
android:id="#+id/deposit"
android:icon="#drawable/ic_wallet"
android:title="Deposit" />
<item
android:id="#+id/profile"
android:icon="#drawable/ic_person"
android:title="Profile" />
build.gradle
plugins {
id 'com.android.application'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.ahmad.workitservices"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding true
}
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.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "com.airbnb.android:lottie:4.2.2"
implementation 'com.github.smarteist:autoimageslider:1.4.0'
implementation 'com.google.android.material:material:1.6.0-alpha01'
}
themes.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.WorkitServices" parent="Theme.MaterialComponents.Light.DarkActionBar.Bridge">
<!-- Primary brand color. -->
<item name="colorPrimary">#color/purple_500</item>
<item name="colorPrimaryVariant">#color/purple_700</item>
<item name="colorOnPrimary">#color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">#color/teal_200</item>
<item name="colorSecondaryVariant">#color/teal_700</item>
<item name="colorOnSecondary">#color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
Try using a Frame Layout to keep the bottom nav as it's child. Also I suppose you have closed the Menu in bottom_nav_menu after the last item. (Also not sure about it but try the code once after removing the android:background property, sometimes it is not feasible but doesn't show error. Happens with me:))
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<FrameLayout
android:id="#+id/any_id"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#+id/bottom_nav"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_nav"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#8603A9F4"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="#menu/bottom_nav_menu"/>
</androidx.constraintlayout.widget.ConstraintLayout>
I have a multimodule project in gradle with the follow structure
root-project:
rest-module
cdi-module
ejb-module
From rest-module I call to the others modules, and tests are working fine, but when I run sonarqube task, I only obtain coverage from rest-module and the others is empty. Also I look for "jacoco.exec" file and only exits in rest module.
My configuration of arquillian is:
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<defaultProtocol type="Servlet 3.0" />
<container qualifier="wildfly-managed" default="true">
<configuration>
<property name="allowConnectingToRunningServer">true</property>
<property name="jbossHome">C:\wildfly-11.0.0.Final</property>
<property name="javaVmArguments">-Xms800m -Xmx800m -XX:MaxPermSize=1024m</property>
<property name="outputToConsole">true</property>
</configuration>
</container>
<extension qualifier="jacoco">
<property name="appendAsmLibrary">true</property>
</extension>
<extension qualifier="reporter">
<property name="report">html</property>
</extension>
and the dependies on my subprojets are:
plugins {
id 'war'
id 'java'
id 'jacoco'
id 'project-report'
}
sourceSets {
test.runtimeClasspath += configurations.jacocoAnt
main {
output.resourcesDir = "build/classes"
}
test {
output.resourcesDir = "build/classes"
}
}
dependencies {
testImplementation ("org.jboss.arquillian.junit:arquillian-junit-container:1.4.0.Final")
testImplementation ("org.jboss.arquillian.protocol:arquillian-protocol-servlet:1.4.0.Final")
testImplementation ("org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-gradle-depchain:3.1.3")
testImplementation ("org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-gradle-embedded-archive:3.1.3")
testImplementation ("org.wildfly.arquillian:wildfly-arquillian-container-managed:2.1.0.Final"
testImplementation (group: 'org.ow2.asm', name: 'asm', version: '5.0.1')
//testImplementation "org.jboss.arquillian.extension:arquillian-jacoco-with-asm:1.1.0"
testImplementation ("org.jacoco:org.jacoco.core:0.8.5"){
exclude group: "asm", module: "asm"
}
testImplementation ("org.jboss.arquillian.extension:arquillian-jacoco:1.1.0"){
exclude group: "asm", module: "asm"
}
}
As per the guidelines in this tutorial.
I've completed everything. But it's not working. No errors are occurring. I don't know where to check for the issues. Please can someone help me with a solution or at least where to look for issues?
Please find below manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
package="uhnm.stroke.strokeapp_secondscreen">
<dist:module dist:instant="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true">
<activity android:name=".NIHSSActivityPage4" android:windowSoftInputMode="adjustPan"/>
<activity android:name=".TeamsDisplay" android:windowSoftInputMode="adjustPan" />
<activity android:name=".imageActivity" android:windowSoftInputMode="adjustPan" />
<activity android:name=".timesActivity" />
<activity android:name=".configurationActivity" />
<activity android:name=".addConsultants" />
<activity android:name=".NIHSSActivityFinalPage"android:windowSoftInputMode="adjustPan" />
<activity android:name=".NIHSSActivityPage3" android:windowSoftInputMode="adjustPan" />
<activity android:name=".NIHSSActivityPage2" android:windowSoftInputMode="adjustPan" />
<activity android:name=".MainActivity" android:windowSoftInputMode="adjustPan" />
<activity android:name=".EnterBrainTracker" />
<activity android:name=".NIHSSActivity" android:windowSoftInputMode="adjustPan" />
<activity
android:name=".signIn"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<meta-data
android:name="strokeapp.messaging.default_notification_channel_id"
android:value="#string/default_notification_channel_id" />
</application>
</manifest>
Here the app gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
//useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "uhnm.stroke.strokeapp_secondscreen"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
packagingOptions
{
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-storage:19.1.0'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation group: "com.twilio.sdk", name: "twilio", version: "7.44.0"
implementation 'com.squareup.okhttp3:okhttp:4.2.1'
}
I am using existing testng-context xml in build gradle
test {
useTestNG() {
suites 'src/test/resources/testng-context.xml'
setTestName 'smoke1'
}
In my testng-context xml, I have different group of tests like smoke1, smoke2:
<test name="smoke1">
<groups>
<run>
<include name="smoke" />
</run>
</groups>
<packages>
<package name="com.servicestesting.tests" />
</packages>
</test>
<test name="smoke2">
<groups>
<run>
<include name="smoke" />
</run>
</groups>
<packages>
<package name="com.uitesting.tests" />
</packages>
</test>
How do I provide this custom tests in my gradle test task?
If I understood correctly, you want to run your test according to the name like smoke1 or smoke2.
May be you should create a new Gradle Task command in your build.gradle file like this:
task smokeTests(type: Test) {
useTestNG() {
useDefaultListeners = true
suites 'src/test/resources/testng-context.xml'
includeGroups 'smoke1'
}
}
Then use gradle smokeTests command to run your tests.
Here's a more detailed article about it.
https://www.swtestacademy.com/how-to-use-testng-with-gradle/
I am in the process of converting a number of projects from ant+ivy to Gradle.
One of the projects (address) produces a simple jar for inclusion into a webapp. I have set up the build.gradle to publish the jar and a sources jar to my private ivy repository.
address/build.gradle excerpt:
apply plugin: 'java'
apply plugin: 'publishing'
apply plugin: 'ivy-publish'
[...snip...]
task sourceJar(type: Jar) {
from sourceSets.main.java
classifier "source"
}
publishing {
repositories {
ivy {
url 'http://dev.example.com/ivy/'
layout "pattern", {
artifact "[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"
}
}
}
publications {
ivy(IvyPublication) {
from components.java
artifact(sourceJar) {
type "source"
}
}
}
}
I publish this with gradlew publish. My webapp then has a dependency on the resulting jar:
compile 'com.example:address:1.0.0'
The problem I have is that when I do gradlew build on the webapp, the war's WEB-INF/lib includes address-source-1.0.0.jar along with the expected address-1.0.0.jar.
I cannot figure out why the source jar is being included in the war. It does not show up in gradlew dependencies.
Here is the ivy.xml being generated for the jar:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="com.example" module="address" revision="1.0.0" status="integration" publication="20141027154452"/>
<configurations>
<conf name="default" visibility="public" extends="runtime"/>
<conf name="runtime" visibility="public"/>
</configurations>
<publications>
<artifact name="address" type="jar" ext="jar" conf="runtime"/>
<artifact name="address" type="source" ext="jar" conf="runtime" m:classifier="source"/>
</publications>
<dependencies>
<dependency org="org.springframework" name="spring-asm" rev="3.0.5.RELEASE" conf="runtime->default"/>
<dependency org="org.springframework" name="spring-beans" rev="3.0.5.RELEASE" conf="runtime->default"/>
<dependency org="org.springframework" name="spring-context" rev="3.0.5.RELEASE" conf="runtime->default"/>
<dependency org="org.springframework" name="spring-expression" rev="3.0.5.RELEASE" conf="runtime->default"/>
<dependency org="org.springframework" name="spring-core" rev="3.0.5.RELEASE" conf="runtime->default"/>
<dependency org="log4j" name="log4j" rev="1.2.14" conf="runtime->default"/>
<dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.5.6" conf="runtime->default"/>
<dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.6" conf="runtime->default"/>
<dependency org="commons-lang" name="commons-lang" rev="2.4" conf="runtime->default"/>
<dependency org="org.slf4j" name="slf4j-api" rev="1.5.6" conf="runtime->default"/>
</dependencies>
</ivy-module>
I think the reason is that the source artifact is published in the runtime configuration as well, if you use a special configuration (e.g. sources) it should work:
publications {
ivyJava(IvyPublication) {
from components.java
configurations.create('sources')
artifact(sourceJar) {
conf "sources"
}
}
}
(configurations.create() is needed because of
GRADLE-3162)