Kotlin - menuInflater cannot find reference of the xml file - android-studio

I am trying to add create option menu to my activity, however the android-studio sent me this error
Unresolved reference: chat_app_menu
Here is my code in Kotlin
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.chat_app_menu)
return true
}
The line with menuInflater.inflate(R.menu.chat_app_menu) show me the error Unresolved reference: chat_app_menu
However, I have been create the resource file chat_app_menu.xml under res\menu\
Here are my import files
package com.example.chat_app
import android.R
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuInflater
import androidx.appcompat.app.AppCompatActivity
import com.google.firebase.auth.FirebaseAuth
My file directory:
What should I do to disable this error to make the app work?

Use your com.example.chat_app.R instead of android.R
import com.example.chat_app.R

Related

jenkins pipeline import org.apache.poi

I am trying to automate with excel and can't import the org.apache.poi for use.
I try something like this:
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
pipeline {
agent any
stages {
stage('excel') {
steps {
script {
SXSSFWorkbook wb = new SXSSFWorkbook(100);
}
}
}
}
}
and get "unable to resolve class org.apache.poi.ss.usermodel.Row" with all of them.
In the script part the error is the same: "unable to resolve class SXSSFWorkbook".
If I download the jar file from search.maven.org where do I put it to be used?
If you are running on Tomcat you can add them to <TOMCAT_HOME>/lib directory. Else you can add them to your JDK itself, into $JAVA_HOME/jre/lib/ext/

Pusher-js is not working with chrome extension V3 migration - window is undifined

We are using pusher-js in our chrome extension application to connect with backend messaging.
Till manifest V2, It worked perfectly fine. But post manifest V3 migration, pusher-js is throwing Uncaught ReferenceError: window is not defined while doing load-unpacked.
I event tried updating the pusher-js npm package, but dint worked.
I am well know that window object is not available in new manifest V3. But how to make pusher-js work in my chrome extension.
This error happens as soon as I import the pusher from pusher-js.
Removing the pusher import, code works perfectly. Can anyone help me on this?
import code pusher
/* global chrome */
// import Config from '../config';
import StatusChecker from '../utils/status-checker';
import StatusCheckerNotifier from '../utils/status-checker-notifier';
import loggingService from '../utils/logging-service';
import fetchProvider from '../fetch';
import fetchGraphqlProvider from '../fetch-graphql';
import { addLinkedInCsrfTokenHeader } from './csrf-token-header';
import LoggingService from './services/LoggingService';
import FetchableService from './services/FetchableService';
import ContractChooserResolver from './services/ContractChooserResolver';
import dispatcher from '../dispatcher';
import ContextRuntime from '../contextruntime';
import { pusherInit } from './pusher-init';
import { SIDEBAR_EVENTS } from '../constants';
import * as Utils from './helpers';
class GoldmineBackend {
init(userMeta) {
console.log('testing');
}
}
export default new GoldmineBackend();
service-worker console error
service-worker console error - source
build load-unpacked error

import a module from other python folder

I have a a project with following path:
shift/
Code/
__init__.py
mymain.py
run.py
Test/
__init__.py
tester.py
runtester.py
requirments.txt
in mymain.py there is a class which I need to import from the tester.py. So in tester.py I'm importing class as following codes but none of them work.
from Code.mymain import NewClass
from .mymain import NewClass
from mymain import NewClass
from shift.Code.mymain import NewClass
I also tried to insert the path in tester.py:
cwd = os.getcwd()
sys.path.insert(0, cwd)
However still confused why it does not know my file
Try like this
import sys
import os
sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '\\Code')
from mymain import NewClass
More details at : importing files from different folder

How can I import a file present in different folder in python?

I have the following structures:
SnapQuick
main
snap_view.py
login.py
signup.py
profile
profile.py
profile.py has the following imports
from os import sys
sys.path.insert(1,'../')
from main import login
import sqlite3
class profile():
def show_profile(self,user_id):
pass(some_code....)
login.py has the following imports
import sqlite3
from os import sys,system
sys.path.insert(1,"../")
import signup
from profile import profile
import snap_main
class login:
def login(self):
On running profile.py I am getting an error
Error:
Traceback (most recent call last): File "profile.py", line 6, in
from main import login File "../main/login.py", line 6, in
import signup ModuleNotFoundError: No module named 'signup'
Try this:
import sys
sys.path.append(".../SnapQuick/profile") (you need whole path)
from profile import login

getting error in "pretty" in cucumber file

Getting below error while running the test runner file,can someone please suggest how to resolve this after changing the different version of the report, still facing the same error
cucumber.runtime.CucumberException: Only one formatter can use STDOUT, now both pretty and pretty use it. If you use more than one formatter you must specify output path with PLUGIN:PATH_OR_URL
at cucumber.runtime.formatter.PluginFactory.defaultOutOrFailIfAlreadyUsed(PluginFactory.java:185)
at cucumber.runtime.formatter.PluginFactory.convertOrNull(PluginFactory.java:144)
at cucumber.runtime.formatter.PluginFactory.instantiate(PluginFactory.java:99)
at cucumber.runtime.formatter.PluginFactory.create(PluginFactory.java:87)
at cucumber.runtime.RuntimeOptions.getPlugins(RuntimeOptions.java:245)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:291)
at com.sun.proxy.$Proxy14.done(Unknown Source)
at cucumber.runtime.junit.JUnitReporter.done(JUnitReporter.java:227)
at cucumber.api.junit.Cucumber.run(Cucumber.java:101)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Test Runner File:-
package com.ntrs.msf.runner;
import java.io.File;
import org.junit.AfterClass;
import org.junit.runner.RunWith;
import com.cucumber.listener.Reporter;
import com.ntrs.msf.managers.FileReaderManager;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
//#RunWith(CucumberWithSerenity.class)
#RunWith(Cucumber.class)
#CucumberOptions(tags = {"#IRR515-Test",}, features = "src/test/resources/features/", plugin = { "pretty",
"com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html" }, glue = {
"com/ntrs/msf/stepDefinitions" }, monochrome = false)
public class Holdings515_Test {
#AfterClass
public static void writeExtentReport() {
Reporter.loadXMLConfig(new File(FileReaderManager.getInstance().getConfigReader().getReportConfigPath()));
}
}
Try changing plugin = to format =
Does that help?

Resources