no gradle file in eclipse project Android studio - eclipse

I am a complete noob with Gradle. I am writing an android application using Android Studio with a co-worker who is using Eclipse. we are sharing our files through git. It was created in eclipse without Gradle. My question is, is it possible to generate the gradle files for the project on my end without him having to export the project on his? I am trying to setup ActionBar Sherlock and its causing me all sorts of trouble I think the lack of a grable.build file might have something to do with it.

You can include abs in your project as a library.
Put a build.gradle in abs module:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+' // You can use also classpath 'com.android.tools.build:gradle:0.6.+' with gradle 1.8
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
android {
compileSdkVersion 18
buildToolsVersion "18.0.1" //use your build version
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
Then in your project module add in build.gradle:
dependencies {
compile project(':libraries:actionbarsherlock') //Use your name
}
You have to setting also setting.gradle
include ':MyApplication'
include ':libraries:actionbarsherlock'
You can see this post:
http://gmariotti.blogspot.it/2013/06/quick-tips-convert-to-new-gradle-based.html
Otherwise, you can ignore the library folder and only use in your project module this script in build.gradle.
Gradle will download from maven the aar format.
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
}

All you need is a simple build.gradle file for your ActionBarSherlock project. Here's one I've created:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
android {
buildToolsVersion "17.0"
compileSdkVersion 17
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}

Related

Unity 2020.2.6 Android build aptOptions noCompress property definition error

today I tried to build my game for Android with Unity 2020.2.6f1 and it gave the error below;
UnityException: Error mainTemplate.gradle file is using the old
aaptOptions noCompress property definition which does not include
types defined by unityStreamingAssets constant.
I disabled the Android Resolvers Patch gradle and manifest files it didn't work.
I tried to edit the gradle manually with;
aaptOptions {
noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
whatever I do when building the game Unity overrides the gradle, I checked the pre-post build process scripts in the project but none of the ones I check changes the gradle' aaptOptions.
The plugins I have in the project are;
Facebook
GameAnalytics
Adjust
mainTemplate.gradle:
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.installreferrer:installreferrer:1.0'
**DEPS**
}
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
defaultConfig {
multiDexEnabled true
minSdkVersion 19
targetSdkVersion 29
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
}
dexOptions {
preDexLibraries false
javaMaxHeapSize "4g"
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
}
aaptOptions {
noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**
}
**SIGN**
buildTypes {
debug {
jniDebuggable true
}
release {
minifyEnabled false
**SIGNCONFIG**
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_8
}
}
Thanks in advance.
you should modify like this in the mainTemplate.gradle file :
aaptOptions {
noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
For me what worked was unchecking the "Custom Gradle Template" option for the build inside Player Settings > Publishing Settings.
Edit: Okay it turns out that I can't replicate that anymore and I am not really sure what kind of wizardry allowed it to happen...
On the other hand, I found what caused the issue for me.
The problem was caused by one plugin I was using, since I was importing an old version of it and for some reason it kept importing gradle documents and other Android related stuff, which were deprecated.
I fixed it by importing everything from the plugin's Unity Package except the Android folder, all the Editor's gradles and gradle related stuff (I didn't import the Editor folder at all) and the Plugins folder.
Let's try this option. Work like champ.
Open file maingradle in Android folder and remove line have string "Proguard" then save file
Go to project setting => untick mainGradle and tick again mainGradle, untick gradle properties template and tick it again. Go to Asset option in top => find option force resolve and rebuild again.

Importing LibGDX project in Eclipse: Could not resolve: project :core

I'm working in a project with someone else, so we need to use the same project file. But I get this notification everytime I try to import his project (which already has code written on it). It is not only missing the whole core folder, but it is also missing pretty much every class.
We have the same JDK(12.0.2), Gradle version (5.4.1) and plugins installed, so I have no idea what I'm doing wrong. I couldn't find anyone else with this same problem.
Task :nothing UP-TO-DATE
Could not resolve: project :core
This is how the project looks when imported and this is how my normal projects look.
I should add I have no troubles with projects created by myself right now, and it took me a REALLY long time to get that to work, so I wouldn't like to mess with the JDK or the Gradle version if it's possible.
EDIT: Someone told me to add the build.gradle file, so here it is:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
}
}
allprojects {
apply plugin: "eclipse"
version = '1.0'
ext {
appName = "JUEGO"
gdxVersion = '1.9.10'
roboVMVersion = '2.3.8'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
google()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java-library"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
}
}
project(":core") {
apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
}
}

Idea cannot recognize a symbol even it is present in external dependencies

Does somebody understands what is a problem? Why my IDE doesn't see classes from dependencies? Idea version: 17.2.2
The root build.gradle:
subprojects.each {
apply plugin: 'idea'
}
The root setting.gradle:
include 'client'
include 'api'
rootProject.name = 'app-1-akka-reactjs'
My build.gradle of api project:
apply plugin: 'play'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.iatoki:gradle-play-idea:0.4.1'
}
}
apply plugin: 'org.iatoki.play-idea'
repositories {
jcenter()
ivy {
url "https://repo.typesafe.com/typesafe/ivy-releases/"
layout "pattern", {
ivy "[organisation]/[module]/[revision]/ivys/ivy.xml"
artifact "[organisation]/[module]/[revision]/jars/[artifact].[ext]"
}
}
}
model {
components {
play {
platform play: '2.5.8', scala: '2.11', java: '1.8'
injectedRoutesGenerator = true
}
}
}
dependencies {
play 'com.typesafe.play:play-slick_2.11:2.1.0'
play 'com.typesafe.play:play-slick-evolutions_2.11:2.1.0'
play 'org.postgresql:postgresql:9.4-1200-jdbc41'
}
The build.gradle of client is empty for now.
To generate idea's files I've used:
gradle cleanIdea idea
I faced a similar issue. I could resolve it by moving/copying the settings.xml file from $MVN_HOME/conf to ~/.m2 folder. As MVN_HOME was not detected by Idea it could not resolve the settings.xml from MVN_HOME.

how to get the gluon Android plugins or .jar: magnetometer, compass, display, position?

For installing a component in Eclipse Neon, we usually add a plugin or a .jar
Or, in case of these plugins for Android, I don't understand how to do?
In the Eclipse Marketplace, I don't see these plugins.
Where can I get them?
My configuration:
Eclispe Neon 2
My Build gradle (some items):
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
dependencies {
compile 'com.gluonhq:charm:4.1.0'
}
jfxmobile {
downConfig {
version '4.0.0'
plugins 'accelerometer', 'compass', 'device', 'orientation', 'storage', 'vibration', 'display', 'lifecycle', 'statusbar', 'position'
}
android {
compileSdkVersion = '23'
buildToolsVersion = '25.0.1'
androidSdk = 'C:/Users/pascal/AppData/Local/Android/sdk'
manifest = 'src/android/AndroidManifest.xml'
}
Thanks

Unable to import spring-boot gradle project in eclipse workspace

Gradle setup for Spring-boot application : build.gradle file i have used sourcesSet where my all java source file resides.
buildscript {
repositories {
//Required repos
mavenCentral()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
mavenLocal()
}
dependencies {
//Required dependency for spring-boot plugin
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.1.2.BUILD-SNAPSHOT'
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'spring-boot'
apply plugin: 'eclipse-wtp'
bootRepackage {
mainClass = 'com.test.app.Application'
}
war {
baseName = 'companies'
version = '0.1'
}
repositories {
mavenCentral()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
mavenLocal()
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web'
//Required dependency for JSP
providedRuntime 'org.apache.tomcat.embed:tomcat-embed-jasper'
}
sourceSets {
main {
java {
srcDir 'app/GeneratedSource'
srcDir 'app/JavaSource'
srcDir 'web/JavaSource'
}
resources {
srcDir 'app/GeneratedSource'
srcDir 'app/JavaSource'
srcDir 'web/JavaSource'
}
}
}
eclipse {
classpath {
defaultOutputDir = file('web/WebContent/WEB-INF/classes')
}
}
webAppDirName = 'web/WebContent'
libsDirName = 'war'
war {
baseName = baseName
version = appVersion
archiveName = warName
}
task printClasspath {
doLast {
configurations.testRuntime.each { println it }
}
enter image description hereCommand Line able to build model
When in eclipse while importing gradle project it is showing error
Iam unable to import Gradle project in Eclipse
Do you have a Gradle plugin for eclipse?
Help -> Eclipse MArketplace -> Search "Gradle" -> Install the Gradle STS integration.
In addition I recomend you change Spring Boot version to '1.3.3.RELEASE'.
buildscript {
ext {
springBootVersion = '1.3.3.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}}
In my case there was an update available for the gradle plugin. Once I updated the plugin using eclipse marketplace everything worked fine and project was imported properly.