Android studio can't run app after creating a new module - android

So I was trying integrate zoom into my app, in the process it requires me to add the zoom libraries to my own module, so I created one, but after creating the module, I can't run my app from the studio, it says module not specified.
When I was creating the module, there was an error in the following file
settings.gradle
include ':libsystem'
include ':mobilertc'
include ':commonlib' <component name ="libraryTable">
I deleted
<component name ="libraryTable">
error was gone.Do I need to include something in this file so that I can run my app?
Nvm, I deleted include':app' in settings.gradle by accident.

Follow these steps and see the example for zoom integration.
Step 1. Create an online zoom account for development.
ZOOM Account Create
Step 2. Create a meeting using API or Manually.
Step 3. Initialize ZOOM SDK.
Github: ZOOM SDK Integration

i never using component name if using another module. as long I can use the file in that module, I think it's good.

Related

How to embed an Android library (AAR file) into a capacitor plugin?

The issue is already answered for iOS:
How to embed framework in capacitor plugin for iOS
For Android, I get issues when I add an aar file to the capacitor plugin by creating a new module. After publishing my capacitor plugin via npm and integrating it into an ionic app, the aar library cannot be found anymore.
As done on iOs, we do practically the same thing here. But, using Android Studio and gradle instead of xcode and cocoapods.
Ok, but first things first.
When the command npx #capacitor/cli plugin:generate is issued, what the CLI does is to start a folder containing a cocoa pod for iOs and a gradle plugin for Android. You can see this on the image below.
With the above command issued, there will be a ios and android folders inside you generated plugin folder. If this checks, open you android studio and select the option to open a android studio project, selecting the android folder to fulfil this procedure. You can select this option on the initial screen, like showed on the next image.
With the project opened, if all went well you'll se your android studio showing a screen like this
Now, lets add the plugin files. To do this, right click the android java module and select the "Open Module settings" option, as shown on the next image.
With the following screen opened, we need to add a module here that contains our jar/aar dependencies. To do that, just click on the + sign that is showed above.
On the new module screen, if you scroll down there will be a "Import .JAR/.AAR package", like shown above.
After that, locate you aar package. The result will be the following.
Click finish and the next screen will appear. If not, hit the apply button in this same screen.
Since my module has a dependency, I'll repeat this part of the tutorial.
Next, we need to add our recently added modules as dependencies of the android module. On the same screen, click on the dependencies option and on the plus sign of the "declared dependencies" pane.
The following screen will show. We need to select the 3rd option, since what we did early was adding a module.
Now, lets select our module. Its simple, just mark it and click ok. Since I have to, as said before, I'll check both of them.
If this step went well, you should have now you android module with one more dependency (or two in my case). The image bellow show that.
Hit apply and close this window. Gradle will rebuild your plugin project on the background and after that,since I know kotlin better, I'll convert my project to kotlin. If you wish, this can be done as shown on the next image, but is not mandatory.
With all the above done correctly, you can now import your lib on the TestPlugin.kt (or .java if you didnt use kotlin). For reference, the image bellow show the minimum implementation for my plugin.
In the plugin folder, we are done. Pack it using npm and install on you app.
Next, to the plugin works properly, we need to add its class on the MainActivity of the app that you'll be using it.
Now, to make it work, i'm not 100% sure that this is the correct way to do it, but since it works I do this way. The way I do is to add the plugin modules on the android module of the app via script. I think i am missing something on the gradle plugin implementation, but since it works.....
To do this, access, on your app, the android/settings.gradle file and append this:
Please note that depending on the changes that you do, the settings.gradle file will be rewritten. Do a script to keep the info always there or check it before build.
Thats it, please comment if you know another way to this next step or in any another if there is a better approach. And, if this answer is useful, please thumbs it up, since this implementation, when finished and working, made me cry a little (of happiness, of course).

Vuforia SDK Examples Not Running - Android

I'm trying to run Vuforia SDK samples from here on Android:
I have already downloaded the main SDK and put those sample files in the sample folder. I have added the Vuforia.jar as a library and dependency to my project. The app runs on my Samsung S4 and shows the Menu but when I click Start on any of the examples it sends me back to the main menu rather than opening the camera. It doesn't show any crash error in the logs.
I'm wondering if anyone has experienced this problem and has managed to fix it?
I had the same issue and when looked at the log it had this message com.vuforia.samples.VuforiaSamples W/System.err: The library libVuforia.so could not be loaded
Then I followed the answer here https://developer.vuforia.com/forum/android/crash-start-button-sample
and that .jar file to the project. This solved the above issue.
Also I had to generate a license key for the app and set it in the last parameter in Vuforia.setInitParameters(mActivity, mVuforiaFlags, "") in the SampleApplicationSession class
try it:
add the Vuforia.jar lib in your project;
go to archive build.gradle (Module:app) and check if the variable 'VUFORIA_SDK_DIR' is correct (in my project it had the value "../../../" but i had to change to "../../"), the path has to lead to your Vuforia SDK dir;
finally, change the method Vuforia.setInitParameters in the archive SampleApplicationSession.java (line: 414), add your vuforia key in the third paramether;
it works to me

How to setup an Android development environment using STS, Android SDK, Maven and Spring Android

Install latest STS (currently 3.4.0)
Setup your Android development environment in STS as per the normal Android development setup steps for an existing IDE: http://developer.android.com/sdk/installing/index.html
For the above step, you could save time by copying the “android-sdk” folder from another developer who has already setup their environment, and point your STS to that android folder (Window-->Preferences-->Android-->SDK Location)
Install m2e-android as per: http://rgladwell.github.io/m2e-android/
Create a sample Android application using Maven
In STS, click on File-->New-->Maven Project
Select your workspace location and Click Next
For the Maven Archetype, select “android-quickstart” and click Next. This archetype should exist if you added the Archetype according to: http://rgladwell.github.io/m2e-android/
Fill in your desired Maven project details and click Next.
In pom.xml, set the "platform.version" tag value to 4.1.1.4
Right click on the project and select Build Project.
Right click on the project and select Run As  Android Application.
It should start up your Android emulator and deploy the ‘Hello World’ application.
Making use of Spring Android libraries in an Android application:
As we are using Maven, follow the instructions here to configure your dependencies: http://projects.spring.io/spring-android
There seems to be an error is using the above dependencies as is. The error is given when trying to run the Android application in STS, it says “Multiple dex files define Lorg/springframework/core/ErrorCoded”. This means that duplicate classes are referenced on the classpath. To avoid this error, remove the maven dependency element “spring-android-auth”.
Using RestTemplate from the Spring Android libraries:
The reference documentation gives you everything you need: http://docs.spring.io/spring-android/docs/1.0.1.RELEASE/reference/html/rest-template.html
Remember that your Android application must register the correct message converter. Eg: restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
Note that your Android application must include uses-permission “android.permission.INTERNET” to allow network calls.

Android Studio Maps Api v2

My code works perfectly on eclipse. I have created a new project on Android Studio and added my classes, I have also followed this popular tutorial answer How can I create an Android application in Android Studio that uses the Google Maps Api v2?
Now the code doesn't show any red flags and it detects the imports fine but when I build the project I get these errors:
Gradle: package com.google.android.gms.maps does not exist
Gradle: package com.google.android.gms.maps.model does not exist
On a side note I have attempted to import the MAPS sample project like the tutorial says and that has worked fine but I do not know why my new project gives me these errors even though I have followed the tutorial to the letter.
Any idea guys?
If you created a new project (which uses Gradle) and then followed the tutorial, it's completely wrong.
When using Gradle (which new projects do by default), you cannot use the UI to add dependencies. You need to add them manually in build.gradle.
It's a crappy solution right now and we're working to make this better.
In short words:
Run Android Studio
Create new project
Create new module of Android Library type, remember to set the package name to com.google.android.gms
Copy res, src folders and AndroidManifest.xml file from google-play-services_lib (you can find it in your SDK folder if you installed it using SDK Manager) to the appropriate folder in your library module ([Project]/[Library]/src/main)
Remove android-support-v4.jar from libs folder under your library module, live only google-play-services.jar and google-play-services.jar.properties files there.
Make sure your build.gradle file in library module contains following:
dependencies {
compile files('libs/google-play-services.jar')
}
Make sure your build.gradle for application module contains following:
dependencies {
compile files('libs/android-support-v4.jar')
compile project(':[LibraryModuleName]')
}
Make sure your settings.gradle contain following:
include ':MapStudio', ':[LibraryModuleName]'
You can grab layout and manifest settings from Google Maps API v2 tutorial
Keep in mind that android-support-v4.jar is neccessary only when you want to support Android v2
You can find more detailed description on my blog.
I have tried and failed many a tutorial on this, but finally find a simple solution that seem to work.
I just installed Android Studio 0.2.3 on my mac, and these are the steps that made me view a maps fragment on a fresh hello world project template:
1) Click the SDK manager button in the toolbar in Android Studio.
2) Under 'Extras' locate 'Google play services' and install it.
3) in your build.gradle file in your src directory, add this line to dependencies:
compile 'com.google.android.gms:play-services:3.1.36'
4) order and install your API-key following this tutorial: https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key
5) add the fragment to your layout xml:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
6) you should now be able to run your project on your device.
For those of you completely confused by everything going on with implementation of external libraries to gradle projects i have the easiest and most reliable solution.
Step by Step Guide: http://aetherstudios.net/pages/gradle.html
this might be a bit of work but it is the most reliable way i have found to get it done.

How to implement Authorize.net in android?

I would like to create a credit card app to take payments in Android using Authorize.net payment gateway.
I found some example code here from Authorize.net).
I followed the instructions however on step 2 I am not able to add its sdk as library with another project. When I create a new project as "ExampleActivity.java" & used this code as explained, I got red line errors on the AuthNet object & Environment.SANDBOX
Can anyone help me How to implement this code without errors?
Add the Authrized_net_lib project as a library project
Add jar file authorize_net_lib jar file in your project
Then Clean the project
Now copy and paste given sample code
It will not give error.

Categories

Resources