0

I am new to AWS. I created AWS sample app which works fine. But when I try to add the code to my new application, I am getting error in Application class on import statement.

import com.amazonaws.mobile.AWSMobileClient;
import com.amazonaws.mobile.push.PushManager;
import com.amazonaws.mobile.user.signin.SignInManager;

public class Application extends MultiDexApplication {

private final static String LOG_TAG = Application.class.getSimpleName();

@Override
public void onCreate() {

// My code //
.
. 
.

Android studio gives error on "mobile" part of these import statements.

I don't know if any Jars needs to be added in the project.

Gradle code builds without the error. Following is my gradle code -

compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'app/libs')
compile 'com.android.support:design:23.2.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.1.0'
compile('com.amazonaws:aws-android-sdk-s3:2.2.11')
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile('com.amazonaws:aws-android-sdk-cognito:2.2.11')
compile('com.amazonaws:aws-android-sdk-mobileanalytics:2.2.11')
compile('com.amazonaws:aws-android-sdk-sns:2.2.11')
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-plus:7.8.0'
compile 'com.android.support:multidex:1.0.0'

Let me know if I should add some more of my code here.

Nis
  • 449
  • 4
  • 13

2 Answers2

2

The classes you try to import do not exist in the AWS SDK. Check the sample to find out where they come from.

F43nd1r
  • 7,690
  • 3
  • 24
  • 62
1

Please read the instructions in the READ_ME/index.html file of your sample download project. The same instructions exist on the Build page in AWS Mobile Hub. There you will find instructions to copy/paste the helper source code that was included in the download into your own project, including the com.amazonaws.mobilehub java package. This source is included in the project download and must be copied to your own product application.

https://forums.aws.amazon.com/forum.jspa?forumID=88

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Andrew C
  • 406
  • 2
  • 6