I am trying to implement OAuth via signpost in an app and found this tutorial which looks like it is eclipse based.
http://nilvec.com/implementing-client-side-oauth-on-android.html
The relevent instructions:"We will use the excellent signpost Java library to implement OAuth access to Gmail. Just download at least the signpost-core and signpost-commonshttp4 jars, copy them to the lib/ folder inside your Android project, right click on the project, and under Properties/Java Build Path you can add them to the build path:"
I tried moving the mentioned .jars to the app/libs folder in my app with no luck. Am I on the right track or is there a better way to handle OAuth in android studio?
Signpost jars are in Bintray JCenter, so you can just add them to your gradle script:
dependencies {
compile(group: 'oauth.signpost', name: 'signpost-core', version: '1.2.1.2')
compile(group: 'oauth.signpost', name: 'signpost-commonshttp4', version: '1.2.1.2')
}
Related
I am working on simple Jenkins plugin for pipilene vizualization. I would like to use d3.js library in my project, but I have no idea how I should integrate npm modules into Jenkins plugin development workflow. Is it even possible?
I have tried putting d3.js source code directly into folder with my js scripts, but it doesn't work and some files are missing for some magical reason.
Im trying to analyse swift app using SonarQube. followed the instructions from here
Im able to run the sonarqube server and running sonar-scanner while running it I'm getting this error
com.sonarsource.A.A.B.A: No license for swift
I'm using this plug in, backelite-sonar-swift-plugin-0.2.4.jar i feel this plug in is free and we can use it. correct me it I'm wrong.
What I did was:
Download Sonarqube LTS version (https://www.sonarqube.org/downloads/)
Download and install dependencies and Sonar-Swift from https://github.com/Backelite/sonar-swift (including sonar-scanner)
Download sonar-project.properties (https://gist.github.com/Edudjr/db51907068ea76b116d11d9a9b13f05f#file-sonar-project-properties) and configure it according to your project. Place it in your project root folder.
Download run-sonar-swift.sh (https://gist.github.com/Edudjr/79a2379842357c33709aecf040d9ae77#file-run-sonar-swift-sh), place it in somewhere in your mac and add to path (/etc/paths). I did a small change in the script because oclint was not running properly.
Start your Sonarqube server (sonar.sh console in sonar folder) and run run-sonar-swift.sh in your project root folder. You should be done.
Manual Installation
In the page dedicated to the plugin you want to install (ex: for Python : SonarPython), click on the "Download" link of the version compatible with your SonarQube version.
Upload the downloaded jar file in your SonarQube Server and put it in the directory : $SONARQUBE_HOME/extensions/plugins.
If another version of the same plugin is already there, you need to remove it, since only one version of a given plugin may be available in the extensions/plugins directory.
Once done, you will need to restart your SonarQube Server.
https://docs.sonarqube.org/display/SONAR/Installing+a+Plugin
Backelite Sonar-Swift last release:
https://github.com/Backelite/sonar-swift/releases
Fire Base messaging stops working with experimental gradle.
How to recreate the issue
Create a project to support firebase notifications
follow
https://firebase.google.com/docs/notifications/android/console-audience
Build and run. Works wonderfully well
Change the gradle to experimental build. Follow steps in Hello Jni example to change to experimental gradle. Forget adding C code for now just make the changes to support experimental gradle. Follow
https://codelabs.developers.google.com/codelabs/android-studio-jni/index.html?index=..%2F..%2Findex#0
Build and Run: Firebase cannot initialise any longer. See logs and search for firebase which indicate Firebase initialisation unsuccessful :(
Gradle version (File -> Project Structure, Project): 2.10
Android Plugin Version (File -> Project Structure, Project): None
SDK Version: “Android SDK Tools” Rev. (Tools -> Android -> SDK Manager) : 25.1.7
Module Compile Sdk Version (File -> Project Structure, Your Module): 24.0.0
Module Build Tools Version (File -> Project Structure, Your Module): 24.0.0
Any workaround please.
Thanks in advance
Thanks and Regards,
PB
I also faced the same problem and spend several days investigating and googling. The problem is that Google Services Gradle Plugin isn't compatible with gradle-experimental. However digging deeper I found out that this plugin doesn't do a lot, it just parses "google-services.json" and generates "app/build/generated/res/google-services/{build_type}/values/values.xml" out of it.
So I just manually generated that file "MyProject/src/main/res/values/google-services.xml"
<?xml version="1.0" encoding="utf-8"?>
<resources>
<! -- Present in all applications -->
<string name="google_app_id" translatable="false">1:1035469437089:android:73a4fb8297b2cd4f</string>
<! -- Present in applications with the appropriate services configured -->
<string name="gcm_defaultSenderId" translatable="false">1035469437089</string>
<string name="default_web_client_id" translatable="false">337894902146-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com</string>
<string name="ga_trackingId" translatable="false">UA-65557217-3</string>
<string name="firebase_database_url" translatable="false">https://example-url.firebaseio.com</string>
<string name="google_api_key" translatable="false">AIzbSyCILMsOuUKwN3qhtxrPq7FFemDJUAXTyZ8</string>
<string name="google_crash_reporting_api_key" translatable="false">AIzbSyCILMsOuUKwN3qhtxrPq7FFemDJUAXTyZ8</string>
</resources>
More info can be found: https://developers.google.com/android/guides/google-services-plugin
Hope this helps.
Just to add to xp-vit's answer (which was incredibly helpful to me) you can add another android client to your firebase project that doesn't use the experimental gradle to generate the XML for you and then you only have to change the "google_app_id" field. This is found under the {YOUR_CLIENT}/client_info/mobilesdk_app_id in the json file.
Might help avoid typos.
Faced the same issue. And it's a hard bug. You don't know that your Firebase events are not being sent until you turn Firebase log into Verbose mode.
For those who doesn't know how to enable Firebase logs:
In AndroidStudio in Terminal window execute the following:
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
Thanks to that I found an error:
Missing google_app_id. Firebase Analytics disabled
I've double checked everything but then I found a ticket in Android bug tracker saying that experimental gradle interferes with Firebase Analytics.
In order to resolve this I've migrated from 'com.android.tools.build:gradle-experimental:0.8.3' to the latest stable regular Gradle plugin 'com.android.tools.build:gradle:2.2.3'.
And everything works like a charm.
So this is how you migrate from experimental gradle plugin to the latest stable plugin v. 2.2.3:
1. Update your gradle scripts.
http://tools.android.com/tech-docs/new-build-system/gradle-experimental/migrate-to-stable In this article after you install everything in sdk mnager you need to do the following:
In your project-level build.gradle file, change the classpath dependency of the gradle plugin to 2.2.0 or higher
buildscript {
repositories {...}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
Switch to Stable Gradle DSL
You only need to follow the instructions in this section of the guide if you are migrating from experimental Gradle. Since the stable version of Gradle does not use the component model mechanism, you need to change some of the DSL in your module-level build.gradle file:
At the top of your module-level build.gradle file, you need to apply the stable version of the plugin as follows:
apply plugin: 'com.android.application'
- also if you have any modules - the first line for them should be the following: apply plugin: 'com.android.library'
Remove the model{} block, including its opening and closing curly braces. The android{} block should not be enclosed within any other DSL elements.
Remove “.apiLevel” suffix from minSdkVersion and targetSdkVerion:
minSdkVersion 16
targetSdkVersion 23
Change the proguardFiles DSL to the following:
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Remove create(“...”) from your productFlavor configurations. For example, use the following DSL to create a “flavor1” product flavor:
-I didn't have those
productFlavors {
flavor1 {
applicationId “com.app”
}
...
}
Only define abiFilters in the ndk{} block--comment out everything else in this block. The stable plugin uses a new externalNativeBuild{} DSL to link Gradle to your CMake or ndk-build project, and set toolchain arguments and compiler flags.
- here I commented out entire ndk{} block
2. Create a CMake build script. Easy
https://developer.android.com/studio/projects/add-native-code.html#create-cmake-script
Do exact how it is told here. Right click on our model in right Project side window. New file. Create it. Paste it. I had only one C++ class so I have a very simple CMakeLists.txt file:
cmake_minimum_required(VERSION 3.4.1)
add_library(
lib-name
SHARED
my_cpp_class.cpp )
3. Link C++ Project with Gradle
Open the Project pane from the left side of the IDE and select the Android view.
Right-click on the module you would like to link to your native library, such as the app module, and select Link C++ Project with Gradle from the menu. You should see a dialog similar to the one shown below
From the drop-down menu, select either CMake or ndk-build.
If you select CMake, use the field next to Project Path to specify the CMakeLists.txt script file for your external CMake project.
! Important: if you have any other modules - do these steps for every module in your project !
And that's it. Clean your project and build it again.
Now you can use Firebase Analytics.
Basically I didn't create or told anything new, so all credits to Google.
I just put together two articles of how to do it and wrote down the steps with my comments.
It's not hard and it will give you more benefits because experimental gradle may cause some problems anytime in the future.
I'm attempting to become a contributor for Spring Security, it's not going so well. I am getting validation errors in Spring Tool Suite although the build/compilation of the .gradle project is succeeding. The errors show up in the "Markers" view in Eclipse. Here is what I've done so far.
Forked the Spring Security master branch on Github
Copied the https URL for my forked branch
In Spring Tool Suite, Import->Git->Projects from Git->Clone URI
After #3 Spring Tool Suite downloaded the project from Git
Spring Tool Suite prompted asking me what type of project to create
I selected "Import as a general project"
I deleted the project from my workspace (but did not delete it on disk)
I imported the project using Import->Gradle->Gradle project and the recommended settings
After everything finishes building, I get the following error in Spring Tool Suite:
The error is accompanied by several messages including the following:
Pointcut cannot be resolved to a type
The method aspectOf() is undefined for the type ...
The method proceed() is undefined for the type ...
This error can be fixed (with an ugly hack) if I open the Eclipse .project file and add the following:
<buildSpec>
<buildCommand>
<name>org.eclipse.ajdt.core.ajbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.ajdt.ui.ajnature</nature>
</natures>
Question
How can I properly set up my development environment? What should I look into for figuring out why I'm getting these errors? I'm currently researching how the gradle/maven configurations relate to the Eclipse .project file, but I have not gotten very far yet.
Here is what works for me (and what I discussed with Rob Winch):
download STS 3.7.2 (not the latest 3.7.3, it has a few issues when importing spring-security projects) from https://spring.io/tools/sts/all. There is a link to previous versions of STS. There you find STS 3.7.2.
install Groovy-Eclipse into that from here: http://dist.springsource.org/snapshot/GRECLIPSE/e4.5/
install the Gradle STS tooling from here:
http://download.springsource.com/release/TOOLS/update/3.7.2.RELEASE/e4.5
after installing all the components mentioned above, import the spring-security projects using the STS Gradle support ("Import -> Gradle -> ...")
it might take a while, but after downloading the necessary artifacts, all those projects should appear in your workspace. The "aspects" one has an error marker on it. Right-click on the project, go to the Groovy context menu entry, and do the "remove Groovy nature" (or something like that). That removes the groovy tooling for that project and it compiles fine.
After all those steps, I get a workspace with all those projects compiling fine. But it looks like we could/should simplify this procedure in the future using an Eclipse Oomph setup file maybe. But that is a story for the future.
Hope this helps!!!
I found this walkthrough on how to bring spring projects into eclipse via gradle. It actually looks like it was based on Spring Security which might create a nice process flow for you.
My guess is, eclipse is not defaulting to use the gradle configuration for its dependency management.
I was trying to add some Java Libraries (AWS SDK for Java, Apache Commons Math, etc.) to my Grails project since some of my Java source code (placed in src/java) had dependencies. By following this answer, I was able to resolve compile errors by adding the jar files to the /lib folder and add it to the build path, as answered here: Add Java Libraries to a Netbeans Grails Project
However, when I call my Java source code from my controller during runtime, it is unable to find the Java libraries that I added, showing a NoClassDefFoundError. Should I be adding something to the BuildConfig.groovy file? I'm not sure what the name convention for the jar files to be added to the dependencies.
The question you refer to is 5 years old. You should use newer resources :)
The preferred approach now is to use dependencies in BuildConfig.groovy, and let Grails (via Ivy or Maven) download the jars for you once and reuse them for various projects.
It's not always obvious what the syntax is, and I find that http://mvnrepository.com/ is a great resource. For example if you search for "commons math" and click through to http://mvnrepository.com/artifact/org.apache.commons/commons-math you'll see a few versions. Click on version 2.2 and you'll see the Maven dependency XML but you can click on the Gradle tab and it's going to be similar to what you need for Grails. So I'd add
dependencies {
compile 'org.apache.commons:commons-math:2.2'
}
and if necessary change compile to runtime, build, etc. depending on what you need the jar in the build process.
In the rare case that you do have a jar that isn't available in a Maven repo (e.g. a shared library at your company) then you can put the jar file in the lib directory. As you've seen, Grails doesn't auto-detect it (this is as of version 2.0). But you can run grails compile --refresh-dependencies to get your jar added to the classpath.
My issue turns out to be the fact that AWS Java SDK had dependencies (Apache HTTP Client) that were not installed yet and that I was unaware of.
This is what I had to configure this for my BuildConfig.groovy file
dependencies {
runtime 'org.apache.httpcomponents:httpclient:4.2.5'
runtime 'com.amazonaws:aws-java-sdk:1.4.7'
}
All the dependencies for AWS Java SDK 1.4.7 can be found here: http://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk/1.4.7. All the dependencies outside of HTTP client were already installed for me, but may not be for your Grails setup.