Can't get MoPub sdk into Android Studio 1.0.2 - android

I downloaded the mopub sdk and been trying to follow:
how to add mopub ads library integration with android studio
but i can't get it to import existing module. it keep saying "select modules to import" when i select the file.
If anyone used android studio 1.0.2 with mopub ads can help.
maybe a step-by-step guide would help. Can't find one for android studio.

I had a similar problem. I followed these steps mentioned here and it worked
Do a sync once you modified the build.gradle file. Then the module should appear in your workspace.
Gradle Integration
Adding as Source
To include the MoPub SDK as source in your project, copy the SDK source into your project as a module. To do this on OS X and Linux, do the following:
$MY_PROJECT_DIR $ mkdir mopub-sdk
$MY_PROJECT_DIR $ cp -R $MOPUB_DIR/mopub-android-sdk/mopub-sdk mopub-sdk
Next, open your project's settings.gradle file and make sure the MoPub SDK is included as a module:
include ':app', ':mopub-sdk'
Open your project's build.gradle file and add the MoPub SDK as a dependency:
dependencies {
compile project(':mopub-sdk')
}

It's not fault of AndroidStudio, just try archived sdk, it works
https://github.com/mopub/mopub-android-sdk/archive/v3.9.0.zip
// sorry I don't enough reputation to post image

Related

How to add a github library to my android project?

I would like to add this library so that I can use it on my android project but I can't figure out how to. I get that I'm supposed to clone it but it doesn't say into which directory I should clone it. I'm also not sure if I should use ant or maven, what those are, and how to do that. Any help would be appreciated.
This is the project I'm hoping to add it to:
https://github.com/mikeoles/swiftset
One more project i which is forked from bauerca/drag-sort-listview
is available for drag-sort-listview and dependency of that project is deployed on maven repository
https://github.com/ened/drag-sort-listview
Gradle is available on mvn repository. check this URL
https://mvnrepository.com/artifact/asia.ivity.android/drag-sort-listview/1.0
Add this to your android project
compile group: 'asia.ivity.android', name: 'drag-sort-listview', version: '1.0'
this project is not a library project instead it is an Android app project so what you have to do is to clone the repo https://github.com/mikeoles/SwiftSet.git and open this as an existing Android project.
FYI, you can check android project structure at this link https://developer.android.com/studio/projects/.
You can make the library support gradle. Or copy code to you project(the project has no update in last 5 years).

how to include android library in android studio ????? (Android Studio)

I installed different packages including (SDK) build tools and updated everything but nothing seems to be working, can any one help ?
Thanks in advance.
You should add this in your app gradle:
dependencies {
compile 'com.google.android.gms:play-services:9.6.1'
}
In Android Studio, left most side you can see set of options like Project, Android,Packages, Project files etc.
select Project --> external libraries..add your libraries in it and try

Compile latest google play-services as dependency in build.gradle file

Am using a Java plugin as I am building a very simple SDK for users to fire an HTTP request from their android phone.
My SDK is packages as a JAR which other users can import in their app and use the methods to fire the request.
I use Grade to build my project and get the Jar file. Until now, I was using a older version of Google Play-Services which had a jar file in my android_home/extras/google/google_play_services/libproject/google-play-services-libs/libs
But I upgraded my Google Play Services to latest version I see this path is no longer available. I see a new path and the packaging is changed to .aar.
I tried to follow some of the methods specified in this forum to convert this .aar file into jar and use it as a dependancy but when I unzip I could not see any classes.jar inside this .aar. I could only see AndroidManifest.xml and R.txt
I am unable to use compile fileTree option in Gradle. Please help me on how can I build my project or what modifications I need to do on my build.gradle file?
Current hack that I am doing is manually download the jar file from:
https://dl-ssl.google.com/android/repository/google_play_services_3159130_r09.zip and using compile fileTree option. I need to get rid of this manual step.
Looking for suggestions.

volley error when importing module

I've been trying to add the volley library to my android project by downloading this repository https://android.googlesource.com/platform/frameworks/volley and then importing the module to my project by following this guide:
First get latest volley with git (git clone >https://android.googlesource.com/platform/frameworks/volley).
In your current project (android studio) click [File] --> [New] -->[Import >Module].
Now select the directory where you downloaded Volley to.
Now Android studio might guide you to do the rest but continue guide to verify >that everything works correct
Open settings.gradle (find in root) and add (or verify this is included):
include ':app', ':volley'
Now go to your build.gradle in your project and add the dependency:
compile project(":volley").
When gradle tries to sync the project after I've imported the module i get the following error message : Error:Could not download layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:24.3.1): No cached version available for offline mode.
I believe you want to use Volley and not contribute to the volley library. if that is the case there are better ways to get volley in your project. let Gradle handle it. Gradle is Build Management tool just like Maven but better, As it gives you more freedom and flexibility.
How to add libraries to gradle in android studio. this link shows a how to add libraries to your android project.
As Android Studio uses Gradle things are pretty neat as it uses the middle ground of ANT and Maven for Build and Management tool.
for volley you can add
compile 'com.mcxiaoke.volley:library:1.0.19'
to the app module of your project. this library can be looked up on Github
or you can do that using android studio's GUI, click on File -> Project Structure
example

Unable to find module with Gradle path. Linking to library -unspecified instead

Update 2 This has been fixed in Android Studio 1.2 Beta 3
Update: This has reportedly been fixed in an upcoming release of Android Studio.
In Android Studio 1.2 Beta 2 I started getting the following warnings when syncing Gradle.
Failed to set up dependencies
Warning:Unable to find module with Gradle path ':Library1'. Linking to library 'Library1-unspecified' instead.
Warning:Unable to find module with Gradle path ':Library2'. Linking to library 'Library2-unspecified' instead.
I've noticed that jumping to a declaration declared in one of the library modules pulls up the Decompiler instead of just going to the actual source in the library module.
In my Android Studio Project I have the following modules:
- App
- Library1
- Library2
Module: App build.gradle snippet:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':Library1')
compile project(':Library2')
}
settings.gradle file:
include ':App'
include ':Library1'
include ':Library2'
project(':Library1').projectDir = new File(settingsDir, '../library1/lib')
project(':Library2').projectDir = new File(settingsDir, '../Library2/lib')
I faced this with Android Studio 2.2.3. The problem was with the .iml file that was causing the problem.
After importing the module folder into the project directory and adding the changes to include module in settings.gradle, delete the .iml file from the module folder and do a Gradle Sync. Then right click on any module in the Project Window and click on "Configure Project Subset...", if the imported module is not checked, check it and Android Studio should do a Gradle Sync. By then the imported module will appear in the Project Window and will have a .iml file regenerated that is does not cause any issues.
delete the .iml file under the error module.
restart Android studio
Right click project, Select "Configure Project Subset ..." and select your module, rebuild your project.
I met the same problem on AS 2.0 preview,
and I fixed it by following steps:
1.Rename the module.
2.Change the names in app/build.gradle and setting.gradle.
3.Start gradle sync.
I don't know why but it works on my issue.
Check in settings. of your app.
Down there is the field "Load/Unload Modules"
Your module might be unloaded, that's why Android Studio ignores it even if you specify it in Gradle.
At least that was the problem for me.
If you are using React-native>60, then you should run npx jetify on root of your project before doing Gradle sync.
For me the following worked in Android Studio 3.5.3
First of all, check if the path is correct in your Gradle settings.
If the path is correct then invalidate caches & restart by navigating to the top 'File' menu
It is a known bug introduced in 1.2 Beta 2.
See This issue on the Android issue tracker. Fix should be out within hours.
I had this problem and solved it by clicking on
File> Ivalidate cache / Restart...
as shown below:
Problem:
This problem can also occur when you change the path to the module.
settings.gradle
include ':app', ':filechooserlibrary'
project(':filechooserlibrary').projectDir = new File('../../repos-github/file-chooser/file-chooser-library/filechooserlibrary')
I changed the path to '../../github/file-chooser/file-chooser-library/filechooserlibrary'
The old path did not exist any more. But then, instead of accepting the new path, Android Studio recreated the old path structure thus referring to an empty directory.
Solution:
So, I deleted this obsolete path structure and restarted Android Studio, after deleting the .iml file (I don't know if this is necessary, but it cannot do harm). Then I reimported the Gradle project and it worked.
Try using an updated version of NDK.
I faced the same issue.
I was using NDK version r17c. Issue solve after using r21e.
Android Studio Version: 4.1.3
OS: Ubuntu 18.04.5

Categories

Resources