Can't import an android studio 3.1.1 library - android-studio

I'm trying to import this two Libraries :
import com.google.android.gms.location.ActivityRecognitionClient;
import com.google.android.gms.location.DetectedActivity;
but the .android turns to red.
this what it shows
Did i forget to add a package to my project ?

You need to add this in your gradle file :
implementation 'com.google.android.gms:play-services:12.0.1'
Check out this : Can't find the class com.google.android.gms.location.LocationClient (android)

Related

error: package com.mapbox.mapboxandroiddemo.R does not exist

When I try to run Mapbox offline and use their template from there website :
https://docs.mapbox.com/android/maps/examples/download-a-simple-offline-map/
I keep getting this error, I tried to google a few things but there was no proper answer - the closest i got was this:
https://github.com/mapbox/mapbox-gl-native/issues/16102
This is the error :
error: package com.mapbox.mapboxandroiddemo does not exist
import com.mapbox.mapboxandroiddemo.R;
Any help would be much appreciated
Delete the import com.mapbox.mapboxandroiddemo.R; line at the top of your file. This should then let your Android Studio suggest a new import of your project's R import line, rather than https://github.com/mapbox/mapbox-android-demo 's

unused import in android studio

I created a dart file while importing in main dart file it'showing the error unused import try to import the directive.how to import the problem?
Android studio is very smart IDE.
In your code you have imported task.dart file but that file is not in use. (You are not using any resource of that class.)
So if you remove that class from your file you will have a batter and clean code, also at compile time that file will be not imported in your code.
Which is best practice.
that's not an error that a warning .
you can delete your import "task.dart" to remove the warning

Having trouble using/installing #pnp/sp modules

I'm trying to use the attachments module, specifically these features:
https://pnp.github.io/pnpjs/sp/attachments/
I've installed all pnp/sp modules necessary (I think!) using : https://pnp.github.io/pnpjs/getting-started/ as a reference.
Problem is I'm getting a 'cannot find module' for the attachments module. Below are the imports:
import { default as pnp } from 'sp-pnp-js';
import { ItemAddResult, Web } from 'sp-pnp-js';
import { sp } from "#pnp/sp"; //this is fine, which suggests it's installed properly?
import { IItem } from '#pnp/sp/attachments'; //cannot find this module
import "#pnp/sp/webs";
import "#pnp/sp/lists/web";
import "#pnp/sp/items";
import "#pnp/sp/attachments";
I've been successfully using pnp.sp features in this particular project so am stumped why I can't import and use the attachments feature.
If this is an existing project, that you've had for a bit, and you've already got #pnp in the package.json file, it may be you're using version 1 of #pnp, and you are reading the documentation for version 2.
I get the same error cannot find module when I add it to a project #pnp/sp 1.3.7
But don't get it with version 2.0.0
Version 1 document for attachments:
https://pnp.github.io/pnpjs/v1/sp/docs/attachments/
Version 2:
https://pnp.github.io/pnpjs/sp/attachments/

How do I make GlideApp Compatible with androidx?

I recently migrated my app from AppCompat to Androidx but now I'm facing a serious issue with GlideApp. Whenever I try building the project, it shows compilation failed.
I tried changing the following import statements,
import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
in the build folder to:
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
But whenever I rebuild it just regenerates the former import statement and returns the following errors:
error: package android.support.annotation does not exist error:
cannot find symbol class NonNull
I found the fix by adding annotationProcessor 'androidx.annotation:annotation:1.1.0' to my dependencies in app build.gradle and was able to build the project with no errors.
Got the solution from here: https://github.com/bumptech/glide/issues/3080#issuecomment-426331231

which jar file support for io class in S40-with-theme jar file

I am working on nokia asha sdk2.0 using S40-with-theme.now my problem is that when i want to import following class but these classes not in S40-with-theme jar file .
These class is following
Code:
import com.sun.lwuit.io.ConnectionRequest;
import com.sun.lwuit.io.NetworkEvent;
import com.sun.lwuit.io.NetworkManager;
import com.sun.lwuit.io.Storage;
Please tell me which jar file I have to import for it. I got stuck please suggest me
Thanks
IO-Classes are in a separate Lib now.
You should look for this jar in the LWUIT-directory
IO/IO-MIDP.jar
and add it to your project in the project dependencies (how to do this depends on the IDE you are using)

Resources