I'm trying to integrate a chatbot on my Pepper robot using Kotlin on Android Studio. I just follow this tutorial step by step.
Testing your Dialogflow agent in standalone
But when I execute this in Kotlin REPL(in module data):
import com.softbankrobotics.chatwithdialogflow.data.DialogflowDataSource
import java.io.File
val stream = File("C:/Users/yuhliu/ChatWithDialogflow/app/src/main/res/raw/credentials.json").inputStream()
val dataSource = DialogflowDataSource(stream)
dataSource.detectIntentTexts("sois intelligent", "my-test-session", "fr")
I got this error
error: unresolved reference: softbankrobotics
import com.softbankrobotics.chatwithdialogflow.data.DialogflowDataSource
My project directory is something like this:
I'm new to Kotlin. Do you have any idea what's going wrong here?
On first opening the Kotlin REPL, you might get:
You’re running the REPL with outdated classes: Build module 'data' and restart
... clicking on that will reload the REPL and the import should work.
(I tried the same as you and had the same error, and the import worked after reload)
Related
I'm new to Android Studio and is trying to create a app for recording invoice relative information.
Currently I'm trying to use "EInvoice" API shared in Github but stuck in object declaration.
Refer to author's advice, I succeeded to add dependency to Android Studio, but always failed in object declaration:
val invSdk = EInvoice("API_KEY")
It seems that Android Studio can't recognize "val" and "EInvoice".
Then I try to declare it with common method:
private EInvoice Invoice=new EInvoice();
Unfortunately Android Studio always failed to compile with error "cannot resolve symbol 'EInvoice' even if I try to add below import code:
import com.github.kevinchung0921:einvoice_sdk:v1.3
Can you please be kind to suggest correct method to declare the external-imported-API object and use functions such as:
val detail = invSdk.getCarrierDetail(header, USER_BARCODE, USER_PASS)
Thanks a lot for your reading and further help.
cannot resolve Error
I'm running a React Native app which has a local Node project as a dependency, managed through yalc. I'm using rn-nodeify to deal with the Node libraries.
Whenever I try using one of the methods/constants from my Node project, I get the above error during react-native start after the app is built (I'm using Intellij's default "Android" configuration to run RN and have an emulator in Android Studio).
I looked up the error message and people say it's related to supports-color, but neither of my projects use that library and installing it didn't fix it either.
Edit:
I'm not sure if this could be related, but I also have to add the lines
import { Buffer } from 'buffer';
import 'reflect-metadata';
global.Buffer = global.Buffer || Buffer
When I use this file from my Node project or I get errors regarding Reflect.hasOwnMetadata and Buffer
In my android project, I have a kotlin object AssetValidator which does some validation over the asset files.
object AssetValidator {
fun validate(assetsDir: File) {
...
}
...
}
Until now, I was calling this function at the startup of my application. But now, I am thinking of calling it from build script instead. But, I am unable to import this package into my gradle file. Android studio is showing Unresolved reference in the import statement. Someone please tell me how to do this.
I'm trying to use this package in my react native project.
So far I've followed all the steps in their installation guide and I made it work on iOS.
However, on Android, every time I try to import Batch or BatchPush in my code like this:
import { BatchPush, Batch } from "#bam.tech/react-native-batch";
I get an error on Android only:
null is not an object (evaluating 'RNBatch.NOTIFICATION_TYPES')
So when I go to node_modules/#bam.tech/react-native-batch/dist/BatchPush.js I see this
const RNBatch = react_native_1.NativeModules.RNBatch;
exports.AndroidNotificationTypes = RNBatch.NOTIFICATION_TYPES;
So somehow the native module is not being imported correctly. Do I need to follow extra steps for this to work?
#bam.tech/react-native-batch is being used with version 5.2.1
npm version 6.14.7
react-native version 0.60.5
Update: it turns out that the package was not linked correctly and that I had to manually add the package in MainApplication.java (I don't know why react-native link did not add this automatically)
Add the import:
import tech.bam.RNBatchPush.RNBatchPackage;
And then add
new RNBatchPackage(), in the getPackages() method.
I am developing an app in Android Studio with target for API 22. I have tried to use the Log class with the method d() but I did not find it. The helper shows only Log()...
What am I missing?
Just import the library import android.util.Log;
And just tips: use alt+space and alt+enter feature from Android Studio
Note:
Alt + Enter = Project quick fix (show intention actions and quick fixes)