aldebaran / qisdk-tutorials

QiSDK sample, contains the tutorials for the QiSDK.
Other
60 stars 42 forks source link

Getting "Cannot resolve symbol RobotActivity" #12

Open rfebbo opened 4 years ago

rfebbo commented 4 years ago

Hello, I am trying to get my pepper robot to perform some simple speech task. I can follow the tutorial all the way up to "Creating a robot application". It seems like step 2 where you "robotify" the application is not working correctly. It creates a file called robotsdk.xml in the assets/robot directory but did not do any other modifications. When I copy the example code at the bottom into MainActivity.java I get the error in the title.

I have tried following the tutorial on a Windows 10 machine and a Linux machine and I get the same problem.

I am able to connect to the robot and slightly move the limbs around using the "Connect" button in the Pepper SDK.

reinhardatovos commented 3 years ago

bump, I have the same problem. Are there any news about this issue?

tcruzcast commented 3 years ago

Hello @rfebbo @reinhardatovos

When you "robotify" your application, the plugin adds as well the QiSDK dependency on your module’s build.gradle file:

dependencies {
...
    implementation "com.aldebaran:qisdk:1.7.5"
    implementation "com.aldebaran:qisdk-design:1.7.5"
...
}

(QiSDK 1.7.5 is the latest released version)

Also make sure that your MainActivity.java contains the import com.aldebaran.qi.sdk.design.activity.RobotActivity

See: https://qisdk.softbankrobotics.com/sdk/doc/pepper-sdk/ch1_gettingstarted/starting_project.html

Let me know if this works for you.

Cheers!

Zwblk commented 3 years ago

the problem is, the dependencies are there. it doesn't work.

the main acivity is like this:

package com.example.myapplication5;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle; 

public class MainActivity extends RobotActivity implements RobotLifecycleCallbacks {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Register the RobotLifecycleCallbacks to this Activity.
    QiSDK.register(this, this);
}

@Override
protected void onDestroy() {
    // Unregister the RobotLifecycleCallbacks for this Activity.
    QiSDK.unregister(this, this);
    super.onDestroy();
}

@Override
public void onRobotFocusGained(QiContext qiContext) {
    // The robot focus is gained.
}

@Override
public void onRobotFocusLost() {
    // The robot focus is lost.
}

@Override
public void onRobotFocusRefused(String reason) {
    // The robot focus is refused.
}

}`

nothing can be resolved. almost everything is "red"

the github Tutorial package didn't work either.

Zwblk commented 3 years ago

When i put in import com.aldebaran.qi.sdk.design.activity.RobotActivity most of the missing classes and methods are there. But still

RobotLifecycleCallbacks QiSDK.register(this, this); QiContext and some of the overrides cannot be resolved

Zwblk commented 3 years ago

still the same issue. Cannot resolve symbol 'RobotLifecycleCallbacks' and at the Overrides Method does not override method from its superclass

Myrddinwylit commented 3 years ago

Any update on this trying to plan a Pepper application, but can't get the aldebaran import to resolve (Did all the above) working on a Mac

riveria2 commented 3 years ago

I have the same issue. The RobotLifecycleCallbacks and the overrides are being highlighted in red, and any attempt to fix them doesn't work. Some of the import statements don't work either. I have followed a tutorial exactly, doing everything the did but nothing works. I am coding using android studio on a Mac. Essentially the same issue as @Zwblk

Dr1zak commented 3 years ago

Same exact issues as everyone above and still no resolution.

BrianSoftbank commented 3 years ago

Hello,

To use the QiSDK, you have to check that you have setup correctly the maven repository that is needed to get the QiSDK dependencies. This is done in your .gradle files that manage how your project is built.

If you encounter this issues, maybe it's because you upgraded your Android Studio to the Arctic Fox version that add the gradle version 7 in your build.gradle project file (check classpath "com.android.tools.build:gradle:7.x.x"). So with this version of gradle, you have to add the maven dependencies in the settings.gradle instead of the build.gradle: see their changelogs https://gradle.org/whats-new/gradle-7/ (Dependency management). Add or replace this code on top of your settings.gradle file:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://qisdk.softbankrobotics.com/sdk/maven/'
        }
    }
}

And in your build.gradle project file, remove your maven link reference inside maven { } it's not needed here anymore.

This is a recent known issue of the automatic process to make a Robot Application that came with this version 7 of gradle. So when create your robot application, always check that your maven is put correctly in the right gradle file.

This should solve your issues and now you can import correctly the QiSDK in your project files.

riveria2 commented 3 years ago

Thanks. This helped to fix the issue and now the build is working!!

Grovesm1998 commented 2 years ago

Hello,

I am now getting similar issues After following this string i get the following comands registering as an unresolved reference. RobotLifecycleCallbacks {} QiSDK QiContext

anaguzman commented 2 years ago

Hello, I have encountered the same issue and I have also made the changes suggested by @BrianSoftbank and @Zwblk , these changes reduced the number of errors but I still have errors that "Cannot resolve symbol" namely: RobotLifecycleCallbacks, QiSDK, QiContext, and the error that a Method doesn't override method from its superclass.

I'm new at using Android Studio and I am using it to program Pepper.

Thank you in advance for your suggestions.

IbrahimShamma99 commented 2 years ago

Any Luck with RobotLifecycleCallbacks issue?

alesarac commented 1 year ago

To solve the remaining problems, it is necessary to import these classes

import com.aldebaran.qi.sdk.QiContext;

import com.aldebaran.qi.sdk.QiSDK;

import com.aldebaran.qi.sdk.RobotLifecycleCallbacks;

import com.aldebaran.qi.sdk.builder.SayBuilder;

import com.aldebaran.qi.sdk.design.activity.RobotActivity;

import com.aldebaran.qi.sdk.object.conversation.Say;
kzamani44 commented 1 year ago

Hello,

I've had this same issue for a while but I just solved it and all the errors cleared.

STEP 1

Make sure your settings.gradle file looks like this

1.png

STEP 2

Go to your modules build.gradile file and add the two lines highlighted

2.png

STEP 3

Make the neccessary imports in your main java file

3.png

STEP 5

Sync your project

This solution worked for me. I hope it does for you guys also.