Strange javafx app look on android - android

I've got a problem with my javafx ported app on android.
After first launch it looks like that:
But when i go to home screen and then rejoin to application it looks as it should be.
build.gradle:
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.1.1'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
mavenCentral()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'pl.siemaeniu500.wszywka.main.Main'
ext.CHARM_DOWN_VERSION = "2.0.1"
dependencies {
compile "com.gluonhq:charm-down-common:2.0.1"
//compile 'com.gluonhq:charm-glisten:3.0.0'
compile 'com.gluonhq:charm:2.1.1'
compile files('D:/Android/Sdk/platforms/android-21/android.jar', 'C:/Users/Kamil/Documents/NetBeansProjects/WszywkaSounds/jfxdvk-8.60.8.jar')
androidRuntime 'com.gluonhq:charm-android:2.1.1'
iosRuntime 'com.gluonhq:charm-ios:2.1.1'
desktopRuntime 'com.gluonhq:charm-desktop:2.1.1'
desktopCompile 'com.github.sarxos:webcam-capture:0.3.10'
}
jfxmobile {
downConfig {
version = '3.0.0'
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
//compileSdkVersion 24
//buildToolsVersion "24.0.3"
androidSdk = 'D:/Android/Sdk'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
main application class:
package pl.siemaeniu500.wszywka.main;
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Screen;
import javafx.stage.Stage;
/**
*
* #author Kamil
*/
public class Main extends Application {
#Override
public void start(Stage stage) throws Exception {
Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
Parent root = FXMLLoader.load(getClass().getResource("FXML.fxml"));
Scene scene = new Scene(root, visualBounds.getWidth(), visualBounds.getHeight());
stage.setScene(scene);
stage.setMaximized(true);
//new FXMLController().initialize();
stage.show();
}
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
What can cause that?

When you set the scene size:
Scene scene = new Scene(root, visualBounds.getWidth(), visualBounds.getHeight());
you are already taking the whole screen on your device, so you don't need to set this:
stage.setMaximized(true);
Removing that line should fix the issue.
As for the build script, you can simplify the dependencies.
In a first step, remove charm-down-common. If you are not using charm glisten you can remove all charm-* dependencies. If you use it, you will use the new version 4+ (uncomment the line below).
dependencies {
// compile 'com.gluonhq:charm:4.0.1'
compile files('D:/Android/Sdk/platforms/android-21/android.jar', 'C:/Users/Kamil/Documents/NetBeansProjects/WszywkaSounds/jfxdvk-8.60.8.jar')
desktopCompile 'com.github.sarxos:webcam-capture:0.3.10'
}
As for the android and jfxdvk jars, those shouldn't be there. The plugin will manage that for you.
dependencies {
// compile 'com.gluonhq:charm:4.0.1'
desktopCompile 'com.github.sarxos:webcam-capture:0.3.10'
}
Reload the project (Project root, right click, Reload Project):
and you will see them under Dependencies -> Compile for Android:

Related

Google Cloud Endpoint error: package MyApi does not exist

I'm getting this error: package MyApi does not exist message when I run MainActivity. There is similar post here in StackOverFlow, but the solution doesn't work for me.
There is not a logcat stacktrace. What happens is that myApi which is the name of the API inside a class in Google Cloud Module backend is not being recognized and I really don't know why.
Class where my Api is located (module backend)
import com.google.api.server.spi.config.Api;
import com.google.api.server.spi.config.ApiMethod;
import com.google.api.server.spi.config.ApiNamespace;
import com.joketellingapp.lacourt.jokesource.JokeSource;
import javax.inject.Named;
/** An endpoint class we are exposing */
#Api(
name = "myApi",
version = "v1",
namespace = #ApiNamespace(
ownerDomain = "backend.builditbigger.gradle.udacity.com",
ownerName = "backend.builditbigger.gradle.udacity.com",
packagePath = ""
)
)
public class MyEndpoint {
#ApiMethod(name = "sayHi")
public MyBean sayHi() {
MyBean response = new MyBean();
response.setData(new JokeSource().getJoke());
return response;
}
}
Class from which i'm trying to access the API (module app)
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v4.util.Pair;
import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.extensions.android.json.AndroidJsonFactory;
import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
import com.google.api.client.googleapis.services.GoogleClientRequestInitializer;
import com.joketellingapp.lacourt.displayjoke.DisplayJoke;
import com.udacity.gradle.builditbigger.backend.myApi.MyApi;
import java.io.IOException;
class EndpointsAsyncTask extends AsyncTask<Pair<Context, String>, Void, String> {
private static MyApi myApiService = null;
private Context context;
#Override
protected String doInBackground(Pair<Context, String>... params) {
if(myApiService == null) { // Only do this once
MyApi.Builder builder = new MyApi.Builder(AndroidHttp.newCompatibleTransport(),
new AndroidJsonFactory(), null)
// options for running against local devappserver
// - 10.0.2.2 is localhost's IP address in Android emulator
// - turn off compression when running against local devappserver
.setRootUrl("http://10.0.2.2:8888/_ah/api/")
.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
#Override
public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
abstractGoogleClientRequest.setDisableGZipContent(true);
}
});
// end options for devappserver
myApiService = builder.build();
}
context = params[0].first;
// String name = params[0].second;
try {
return myApiService.sayHi().execute().getData();
} catch (IOException e) {
return e.getMessage();
}
}
#Override
protected void onPostExecute(String result) {
// Toast.makeText(context, result, Toast.LENGTH_LONG).show();
Intent intent = new Intent(context, DisplayJoke.class);
intent.putExtra(DisplayJoke.JOKE_KEY, result);
context.startActivity(intent);
}
}
Build.gradle file (Module App)
apply plugin: 'com.android.application'
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
}
}
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.joketellingapp.lacourt.jokeapp"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation project(path: ':backend', configuration: 'endpoints')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.api-client:google-api-client:1.23.0'
implementation 'com.google.http-client:google-http-client-android:1.23.0'
implementation 'com.google.code.findbugs:jsr305:3.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
api project(':jokeSource')
api project(':displayjoke')
api project(path: ':backend', configuration: 'endpoints')
// api project(path: ':backend')
}
Build.gradle file (Module Backend)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
}
}
repositories {
jcenter()
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
appengine.run.port = 8888
dependencies {
implementation 'com.google.endpoints:endpoints-framework:2.0.9'
implementation 'javax.inject:javax.inject:1'
implementation 'javax.servlet:servlet-api:2.5'
implementation 'com.google.api-client:google-api-client:1.23.0'
implementation 'com.google.http-client:google-http-client-android:1.23.0'
compile project(path: ':jokeSource')
}
Top level Build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.guava:guava:22.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir;
}
According to the new plugin docs, it should be endpointsServer project(path: ":server", configuration: "endpoints").

Intellij Idea 2016.3 complains about Android API level in non-Android module

My project is build by gradle and is structured into android, core, desktop modules. Where android is an Android module, but both core and desktop modules are java modules. The core is dependency of both android and desktop. When I write (in desktop):
Queue<P> qeueue= new ArrayDeque<P>();
The Idea complains:
Cast from ArrayDeque to Queue requires API level 9 (current min is 1)
How can I avoid this complain? Disable the inspection on whole project doesn't seems right. I also do not want to convert the desktop to be an Android module.
Project's build.gradle:
buildscript {
repositories {
// repositories
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
allprojects {
apply plugin: "idea"
version = '1.0'
ext {
appName = 'my-app-name'
}
repositories {
// repositories
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
// some dependencies here
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
// some other dependencies here
}
}
project(":core") {
apply plugin: "java"
dependencies {
// some dependencies here
}
}
Core's build.gradle:
apply plugin: "java"
sourceCompatibility = 1.6
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = ["src/", "postprocessing/", "gl/", "math/", "experiment/"]
dependencies {
}
Desktop's build.gradle:
apply plugin: "java"
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = ["src/", "experiment/", "resources/"]
project.ext.mainClassName = "cz.plajt.wallp.hills.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../android/assets");
task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
}
task dist(type: Jar) {
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from { configurations.compile.collect { zipTree(it) } }
from files(project.assetsDir);
manifest {
attributes 'Main-Class': project.mainClassName
}
}
dist.dependsOn classes
dependencies {
}
This is a known issue for IntelliJ, and I am facing the same issue. I can't even get the project to compile in IntelliJ.
https://youtrack.jetbrains.com/issue/IDEA-122904
There doesn't seem to be a workaround for this.

Android java.lang.NoClassDefFoundError: R$string

whenever i run a unit test, i get this error when it tries to retrieve a string value from a custom config.xml file.
Background:
The project itself is a library apk project that uses and references another library APK project.
The error occurs when the project itself tries to initiate a new object that is a subclass of a super class contained on the referenced library apk project.
The Issue explained more below
The specific line of code that fails with the error is a static variable defined below:
protected static final String ANDROID_CONFIG_ID = LibraryApplication.getApplication().getString(R.string.api_checkout_config_id_override);
it fails with the following error:
java.lang.NoClassDefFoundError: com/jon/commonlib/R$string
commonLib is the referenced library apk if you are wondering.
Here is my unit test
#RunWith(RobolectricTestRunner.class)
#Config(constants = BuildConfig.class, manifest=Config.NONE)
public class TestSearchShows {
#Test
public void testSearchJsonFile(){
EventsTestHelper testHelper = new EventsTestHelper(RuntimeEnvironment.application);
try {
ShowsList showList = testHelper.getShowList(new SearchEvent());
if(showList.getShows().size() < 0){
Assert.fail("show list is empty");
}
} catch (IOException e) {
e.printStackTrace();
Assert.fail(e.toString());
}
}
}
The EventsTestHelper is the sub class for a super class called NetworkHelper which looks like this:
public abstract class NetworkHelper<T, P, S> implements NetworkConstants {
protected static final String ANDROID_CONFIG_ID = LibraryApplication.getApplication().getString(R.string.api_checkout_config_id_override);
//other stuff ....
}
I use robolectric version 3.0 the latest for runing ,my unit tests.
If i was to run the code live and call and initiate the sub class, it works perfectly fine, no crashes
edit: Here is snippets of my build gradle file below
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.library'
apply plugin: 'crashlytics'
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
maven { url 'http://www.testfairy.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
classpath 'com.testfairy.plugins.gradle:testfairy:1.+'
}
}
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 19
buildToolsVersion "22.0.1"
def package_namespace = "com.jonney.moduleApp"
defaultConfig {
minSdkVersion 14
testApplicationId "com.jonney.moduleApp"
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
productFlavors {
//testing {
//}
local {
}
mock {
}
qa {
}
//qa4 {
//}
production {
}
}
sourceSets {
local {
res.srcDir 'build-config/local/res'
}
testing {
res.srcDir 'build-config/testing/res'
}
mock {
res.srcDir 'build-config/mock/res'
}
qa {
res.srcDir 'build-config/qa/res'
}
qa4 {
res.srcDir 'build-config/qa4/res'
}
staging {
res.srcDir 'build-config/staging/res'
test.java.srcDirs += 'src/main/java'
}
production {
res.srcDir 'build-config/production/res'
test.java.srcDirs += 'src/main/java'
test.java.srcDirs += "build/generated/source/r/production"
test.java.srcDirs += "build/generated/source/buildConfig/production"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.google.code.gson:gson:2.3'
testCompile('org.robolectric:robolectric:3.0') {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile 'com.fasterxml.jackson:jackson-parent:2.5'
compile 'com.squareup:otto:1.3.6'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile "joda-time:joda-time:2.4"
testCompile('junit:junit:4.12') {
exclude module: 'hamcrest'
exclude module: 'hamcrest-core'
}
testCompile 'org.hamcrest:hamcrest-all:1.3'
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile 'com.squareup:otto:1.3.6'
compile 'com.squareup.okhttp:okhttp:2.3.0'
testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.android.support:multidex:1.0.0'
compile(name: 'commonLib 1.0 1', ext: 'aar')
testCompile(name: 'commonLib-1.0 1', ext: 'aar')
}
edit: i have also tried to manually create a task that copies the r class for each dependency.
afterEvaluate { project ->
android.libraryVariants.each { variant ->
// workaround for missing R class for aar dependencies
def copyTaskName = "copy${variant.name.capitalize()}AppCompat"
def copyTaskNameTwo = "copy${variant.name.capitalize()}commonlib"
task(copyTaskName, type:Copy) {
dependsOn "process${variant.name.capitalize()}Resources"
from { "build/generated/source/r/${variant.dirName}/$package_namespace_path" }
into { "build/generated/source/r/${variant.dirName}/com/jon/commonlib" }
// into { "src/test/java/android/support/v7/appcompat" }
include 'R.java'
filter { line -> line.contains("package ${package_namespace};") ? 'package android.support.v7.appcompat;' : line }
outputs.upToDateWhen { false }
}
task(copyTaskNameTwo, type:Copy) {
dependsOn "process${variant.name.capitalize()}Resources"
from { "build/generated/source/r/${variant.dirName}/$package_namespace_path" }
into { "build/generated/source/r/${variant.dirName}/android/support/v7/appcompat" }
// into { "src/test/java/android/support/v7/appcompat" }
include 'R.java'
filter { line -> line.contains("package ${package_namespace};") ? 'package com.jon.commonlib;' : line }
outputs.upToDateWhen { false }
}
System.out.println("adding ${copyTaskName} build/generated/source/r/${variant.dirName}/$package_namespace_path ")
println("basename = ${variant.baseName}")
println("directory name = ${variant.dirName}")
tasks.getByName("compile${variant.name.capitalize()}UnitTestJava") dependsOn copyTaskName
}
}
Kind regards
jonnney
The project itself is a library apk project that uses and references another library APK project.
For this type of projects exist an already known issue https://github.com/robolectric/robolectric/issues/1796 but you can workaround it.
The base issue is the android/gradle behaviour for library projects which is different compared to application projects. It just ignores to generate R classes from aar dependencies.
To workaround you can provide your own R class which already contains all dependencies R values. Here an example for the appcompat dependency
afterEvaluate { project ->
android.libraryVariants.each { variant ->
// one line for each aar dependency
tasks.getByName("assemble${variant.name.capitalize()}").dependsOn copyAppcompat
}
}
// copy it for each aar dependency and adjust it to your needs
task copyAppcompat(type: Copy) {
// replace the base package with yours (all after /r/debug/) which contains your R.class
from 'build/generated/source/r/debug/com/example/core'.replace("/", File.separator)
// replace the library packages with yours (all after /test/java/) with your aar dependency base package
into 'src/test/java/android/support/v7/appcompat'.replace("/", File.separator)
// also replace the package declaration or you will get compile errors
filter { line -> line.contains('package com.example.core;') ? 'package android.support.v7.appcompat;' : line }
include 'R.java'
}
An example project with your setup can be found at https://github.com/nenick/AndroidStudioAndRobolectric/tree/library-with-aar
Are you including the library in your testing classpath?
dependencies {
androidTestCompile(<reference to commonLib>)
}
I wasn't able to reproduce this in any way, but here are two things that might help.
Try using RobolectricGradleTestRunner instead of RobolectricTestRunner
You shouldn't need to put your other library in testCompile. So I think you can safely remove testCompile(name: 'commonLib-1.0 1', ext: 'aar')
Let me know in the comments if you have any updates after you try the different runner.

Google Apps Engine Backend - Javax.persistence missing - Android Studio

I'm trying to migrate to Android studio and my app engine code uses the Entity framework listed below
import javax.persistence.Entity;
import javax.persistence.Id;
#Entity
public class AppVersion {
#Id
private String applicationName;
private int minVersionRequired;
public String getApplicationName() {
return applicationName;
}
public int getMinVersionRequired() {
return minVersionRequired;
}
public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}
public void setminVersionRequired(int minVersionRequired) {
this.minVersionRequired = minVersionRequired;
}
}
Just creating a backend in Android Studio (0.5.6) doesn't work, I can't import javax.persistence.*
From this link I discovered that I needed to create a persistence.xml file (this was automatically created in Eclipse). I just can't figure out where in the file structure it is supposed to go. I understand it needs to be in the META-INF folder but I don't know where that corresponds for gradle (or if it has to be created in the gradle build file).
Current file structure:
-src
-main
-java
-com.package.test
class files
-webapp
-css
-js
-WEB-INF
Gradle build file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.1'
}
}
repositories {
mavenCentral();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.1'
compile 'com.google.appengine:appengine-endpoints:1.9.1'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.1'
compile 'javax.servlet:servlet-api:2.5'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
Android Studio's App Engine samples don't use JPA.
However if you want to use JPA, you need to add the JPA dependencies, this describes where you might find out what those are https://developers.google.com/appengine/docs/java/datastore/jpa/overview-dn2
So these (or some subset of these)
asm-4.0.jar
datanucleus-api-jpa-3.1.3.jar
datanucleus-core-3.1.3.jar
jdo-api-3.0.1.jar
datanucleus-api-jdo-3.1.3.jar
datanucleus-appengine-2.1.2.jar
geronimo-jpa_2.0_spec-1.0.jar
jta-1.1.jar
Look on maven.org for those dependencies will reveal how to include them in build.gradle files as compile dependencies:
asm-4.0 :
compile 'org.ow2.asm:asm:4.0'
datanucleus-api-jpa-3.1.3 :
compile 'org.datanucleus:datanucleus-api-jpa:3.1.3'
and so on.
You want the versions to be exactly as they are in the appengine sdk to ensure compatibility. Also make sure you run the enhance task on your project.
Try adding following to the build.gradle
compile group: 'javax.persistence', name: 'persistence-api', version: '1.0'

gradle espresso - Empty test suite

trying to run espresso integration-tests with gradle/Android-Studio - but no test is found:
package net.espresso_test;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.SmallTest;
#SmallTest
public class AddTest extends ActivityInstrumentationTestCase2<MainActivity> {
public AddTest() {
super(MainActivity.class);
}
public AddTest(Class<MainActivity> activityClass) {
super(activityClass);
}
#Override
public void setUp() throws Exception {
super.setUp();
// Espresso will not launch our activity for us, we must launch it via getActivity().
getActivity();
}
#SuppressWarnings("unchecked")
#SmallTest
public void testAddItem() {
fail();
}
}
this is the build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
maven {
url project.hasProperty('ligisMavenUrl') ? ligisMavenUrl : "https://raw.github.com/ligi/ligis-mvn-repo/master";
}
}
android {
compileSdkVersion 19
buildToolsVersion "19"
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
}
dependencies {
compile files('libs/socialauth-android-3.0.jar')
compile files('libs/volley.jar')
instrumentTestCompile files('libs/espresso-1.0-SNAPSHOT-bundled.jar')
instrumentTestCompile 'com.google.guava:guava:11.0.2'
compile 'org.ligi:AXT:0.21'
compile 'com.android.support:appcompat-v7:18.0.0'
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.android.gms:play-services:3.2.25'
compile 'com.squareup.dagger:dagger:1.1.0'
compile 'com.squareup.dagger:dagger-compiler:1.1.0'
compile 'com.jakewharton:butterknife:3.0.0'
}
have also tried a lot of other repos from github - all have the same problem - here is a hint that it could have to do something with guava ( which I do not use in this project ) - but no solution yet:
https://groups.google.com/d/msgid/android-test-kit-discuss/0e8bf175-498f-438e-b883-35b76bcede8d%40googlegroups.com
really stuck here - would love to get any hint or ideally a link to a repo where it is working ..
I think you'll find that guava is a dependency for Espresso.
https://code.google.com/p/android-test-kit/source/browse/#git%2Fbin%2Fespresso-dependencies%253Fstate%253Dclosed
You are using both the bundled espresso jar and a guava import which look like they contradict each other.
instrumentTestCompile files('libs/espresso-1.0-SNAPSHOT-bundled.jar')
instrumentTestCompile 'com.google.guava:guava:11.0.2'
The bundled version of espresso comes with guava 14.0.1.
Remove the surplus guava jar you have in the gradle test dependencies.
If this doesn't work can you also post the relevant section of you test manifest.

Categories

Resources