AWS MobileHub Android - Import statement com.amazonaws.mobile - android

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.

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

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

Related

Android Firebase Email and password authentication does not work

I am trying to create accounts in an Android app using Firebase. When I add the following dependencies in the app build.grade file -
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.firebaseui:firebase-ui:1.0.1'
compile 'com.google.firebase:firebase-auth:10.0.0'//added also tried 10.0.1
testCompile 'junit:junit:4.12'
}
I get the following cryptic build error (btw I'm not using any Twitter SDKs or anything to the best of my knowledge):
Error:Failed to resolve: com.twitter.sdk.android:twitter:2.2.0
When I change the dependecies to:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.firebaseui:firebase-ui:0.6.2'//changed
compile 'com.google.firebase:firebase-auth:9.8.0'//changed
testCompile 'junit:junit:4.12'
}
the app build and compiles fine, but when I try to create the account, I get the following error:
Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/
I am at a loss as to what I should do because I think I'm using the latest version of the Firebase SDK.
Some more information is that I have used both mFirebaseRef.createUser() and mAuth.createUserWithEmailAndPassword with no success.
I used this link to change the dependencies.
Any help will be deeply appreciated.
You are mixing the legacy SDK:
compile 'com.firebase:firebase-client-android:2.5.2'
with the new SDK:
compile 'com.google.firebase:firebase-auth:10.0.0'
This will cause a number of problems and is the reason for this error message:
Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/
For new development, you should use only the new SDK. Delete this line from your dependencies:
compile 'com.firebase:firebase-client-android:2.5.2'
The latest versions of FirebaseAuth require additional repositories. Make this change to your project (top-level) build.gradle file:
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
mavenLocal()
}
}
The change is excerpted from the Firebase Sample project. It will eliminate this error:
Error:Failed to resolve: com.twitter.sdk.android:twitter:2.2.0
you should use the correct firebase authentication version from Google:
compile 'com.google.firebase:firebase-auth:10.0.1'
And you have to setup Firebase as it is described in the official documentation

What is the new way of adding compile 'com.google.firebase:firebase-database:9.6.0'?

When I initially used the code below in my build.gradle file, it helped me import the authentication.
compile 'com.google.firebase:firebase-auth:9.2.1'
After adding the below code to my build.gradle file
compile 'com.google.firebase:firebase-database:9.6.0'
Making me to have:
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.google.firebase:firebase-database:9.6.0'
together in my dependency, hence my authentication stopped working, displaying an error message in my MainActivity that I declared it.
"Cannot resolve symbol FirebaseUser" since FirebaseUser is what I named my import to be. Please help.
add same Dependencies version..
compile 'com.google.firebase:firebase-auth:9.6.0'
compile 'com.google.firebase:firebase-database:9.6.0'

How to import libstreaming in Android Studio?

I am a old developer with Eclipse IDE now I switched to Android Studio. I want to use the below tutorial
Live Stream Library
I want to import the libstreaming library to Android Studio.
libstreaming
With the help of Fritte's comment on this page, I did the following to import libstreaming into my Android Studio (v1.5.1) project:
Create a new Android Project
Clone libstreaming into an other directory
In your new Android Project, File > New > Import Module > Path to libstreaming
You can then add libstreaming as a dependency in your app by adding compile project(':libstreaming') to the dependencies section of your build.gradle (Module:app) file. E.g., mine now looks like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile project(':libstreaming')
}

Importing AndroidMapsExtensions into Android Studio

I have been trying relentlessly to use this library. Everytime I add it, I lose all android.support.v4 and com.google.android.gms.maps cababilities. There is very little documentation for this library.
Is there any tutorial that I have overlooked in my extensive Google searching?
Here's my gradle file:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.androidmapsextensions:android-maps-extensions:2.2.0'
}
Also, I was using the raw code. Just found a jar on the net. Should I be using that instead?
what conflict you that you are using two dependencies with common function
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.androidmapsextensions:android-maps-extensions:2.2.0'
when you using it in your application make sure which library imported
example
you try use GoogleMap
you have two options in import
import com.google.android.gms.maps.GoogleMap;
**OR**
import com.androidmapsextensions.GoogleMap;
.........
...
private GoogleMap map;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// options instance from MarkerOptions
// choose map extensions if you want pass data by setData method
map.addMarker(options).setData(data);
}
Summary
Organize your imports as your need from google map libraries

error: package com.facebook.android does not exist in android studio project

I am new to android studio.I am developing an app which uses Facebook SDK.I have downloaded Facebbok SDK and imported it as a module to my android project.I am using latest version of android studio.So I simply imported it and did not make any change in other files for this.First I am trying to use facebook login functionality.But when I build the app I am getting following error.
error: package com.facebook.android does not exist
I could see one solution as an answer to someone's question. But i could not understand it.Please somebody help me.
check you build.gradle
it should got this dependency
if you got library project:
dependencies {
compile project(':facebook');
}
if you got jar files in libs folder:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
or just add maven central dependency to:
dependencies {
compile 'com.github.asne.facebook:facebook:3.17.2'
}
You need to add dependencies on your gradle file :-
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
above is path you need to add dependencies {} like below :-
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
Is the facebook library is jar file or library project?
If is jar file, you just need to add jar file in libs folder and dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
} in build.gradle.
If is library project, you should modify your setting.gradle and build.gradle files.
Adding this line of code to the dependencies in the build.gradle file helped me get rid of the same error.
dependencies {
...
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
}
From platform=android facebook developers
-the last line of the section "Add Facebook SDK to Your Project")

Categories

Resources