When executing ./gradlew clean connectedAndroidTest with the following configuration... I'm getting No tests found
This is my build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.1'
classpath 'com.github.jcandksolutions.gradle:android-unit-test:2.0.1'
}
}
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
}
}
apply plugin: 'com.android.application'
android {
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LGP2.1'
exclude 'META-INF/LGPL2.1'
}
compileSdkVersion 21
buildToolsVersion "21.1.0"
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.example"
minSdkVersion 9
targetSdkVersion 21
versionCode 2
versionName "0.1"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
buildTypes {
release {
runProguard false
}
}
sourceSets {
androidTest {
setRoot('src/espressoTest')
}
}
}
apply plugin: 'android-unit-test'
dependencies {
// App
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:gridlayout-v7:18.0.0'
compile 'joda-time:joda-time:2.3'
compile 'com.google.code.gson:gson:2.2.4'
compile 'de.greenrobot:eventbus:2.0.2'
compile 'com.squareup.dagger:dagger:1.1.0'
compile 'com.squareup.dagger:dagger-compiler:1.1.0'
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'com.squareup.picasso:picasso:2.3.4'
compile 'com.squareup:otto:1.3.5'
compile 'com.google.guava:guava:18.0'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.wrapp.floatlabelededittext:library:0.0.3'
compile 'com.daimajia.swipelayout:library:1.0.7#aar'
compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
compile 'info.hoang8f:android-segmented:1.0.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.0#aar'
compile 'com.daimajia.androidanimations:library:1.1.2#aar'
compile 'com.balysv.materialmenu:material-menu-toolbar:1.4.0'
// Espresso
androidTestCompile files('lib/espresso-1.1.jar', 'lib/testrunner-1.1.jar', 'lib/testrunner-runtime-1.1.jar')
androidTestCompile 'com.google.guava:guava:14.0.1'
androidTestCompile 'org.hamcrest:hamcrest-integration:1.1'
androidTestCompile 'org.hamcrest:hamcrest-core:1.1'
androidTestCompile 'org.hamcrest:hamcrest-library:1.1'
// Robolectric
testCompile('junit:junit:4.11') {
exclude module: 'hamcrest-core'
}
testCompile files('lib/robolectric-2.4-SNAPSHOT-jar-with-dependencies.jar')
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'com.squareup:fest-android:1.0.+'
testCompile 'com.googlecode.catch-exception:catch-exception:1.2.0'
}
tasks.findByName("assembleDebug").dependsOn("testDebugClasses")
This is the class for the tests under src/espressoTest:
package com.example;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
import com.betavalue.myvalue.MainActivity;
import com.betavalue.myvalue.R;
import static com.google.android.apps.common.testing.ui.espresso.Espresso.onView;
import static com.google.android.apps.common.testing.ui.espresso.assertion.ViewAssertions.matches;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withId;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withText;
#LargeTest
public class MainEspressoTest extends ActivityInstrumentationTestCase2<MainActivity> {
#SuppressWarnings("deprecation")
public MainEspressoTest() {
// This constructor was deprecated - but we want to support lower API levels.
super(MainActivity.class);
}
#Override
public void setUp() throws Exception {
super.setUp();
// Espresso will not launch our activity for us, we must launch it via getActivity().
getActivity();
}
public void testCheckText() {
onView(withId(R.id.text))
.check(matches(withText("Hello Espresso!")));
}
}
And MainActivityis an empty Activity just to try testing.
Any ideas? Is there something on the AndroidManifest.xml I could be missing?
If anyone is having this issue... It just solved automatically when pulling it from my repository again.
It had to do something with Android Studio cache.
Related
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/common/annotations/Beta.class`
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.critinno.herenowfor"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles
getDefaultProguardFile('proguard-android.txt'),
'proguard- rules.pro'
}
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
res.srcDirs = ['src/main/res', 'src/main/res/drawable']
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'lib/armeabi-v7a/libblasV8.so'
exclude 'com/google/android/gms/ads/AdActivity.class'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.nex3z:flow-layout:0.1.3'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-storage:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
testCompile 'junit:junit:4.12'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.lorentzos.swipecards:library:1.0.9'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile("com.google.apis:google-api-services-language:
v1beta1-rev5-1.22.0") {
exclude module: 'httpclient'
exclude module: 'jsr305'
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile (group: 'com.google.cloud',
name: 'google-cloud-bigquery', version: '0.17.2-beta'){
exclude group: 'org.json'
exclude group: 'org.apache.httpcomponents'
}
}
apply plugin: 'com.google.gms.google-services'`
A week ago I started implement Chat System to my app using Smack API (4.1.8 version). And It works well on Lolipop device and Marshmallow too. But on Kitkat( API 19) I get exception NoClassDefFoundError
LogCat:
Process: mobi, PID: 23510
java.lang.NoClassDefFoundError: org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration
at mobi.networking.ChatXMPPConnection.connect(ChatXMPPConnection.java:76)
at mobi.networking.ChatXMPPService.initConnection(ChatXMPPService.java:80)
at mobi.networking.ChatXMPPService.access$100(ChatXMPPService.java:36)
at mobi.networking.ChatXMPPService$1.run(ChatXMPPService.java:112)
at java.lang.Thread.run(Thread.java:841)
So what is it on the line 76(the first line):
XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
configBuilder.setUsernameAndPassword(mUsername, mPassword);
configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
configBuilder.setResource("Android");
configBuilder.setServiceName(DOMAIN);
configBuilder.setHost(HOST);
configBuilder.setPort(PORT);
My build-gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
dataBinding
{
enabled = true
}
defaultConfig {
applicationId "mobi"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.1'
compile 'com.android.support:design:24.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.android.support:recyclerview-v7:24.0.1'
compile 'com.zaihuishou:expandablerecycleradapter-databinding:1.0.0'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-SNAPSHOT'
compile 'com.kyleduo.switchbutton:library:1.4.1'
compile 'info.hoang8f:android-segmented:1.0.6'
compile 'com.github.Kennyc1012:BottomSheet:2.3.1'
compile 'com.aurelhubert:ahbottomnavigation:1.3.3'
compile 'com.vk:androidsdk:1.6.5'
compile 'com.brucetoo.pickview:library:1.2.2'
compile 'gun0912.ted:tedpermission:1.0.0'
compile 'com.squareup.okio:okio:1.11.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.basgeekball:awesome-validation:1.3'
compile 'com.google.code.gson:gson:2.4'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.github.aakira:expandable-layout:1.6.0#aar'
compile 'fr.xebia.android.freezer:freezer:2.0.3'
provided 'fr.xebia.android.freezer:freezer-annotations:2.0.3'
apt 'fr.xebia.android.freezer:freezer-compiler:2.0.3'
compile "me.henrytao:smooth-app-bar-layout:24.2.1.0"
compile ("org.igniterealtime.smack:smack-android-extensions:4.1.8") {
exclude group: 'xpp3', module: 'xpp3'
}
compile ("org.igniterealtime.smack:smack-tcp:4.1.8"){
exclude group: 'xpp3', module: 'xpp3'
}
compile ("org.igniterealtime.smack:smack-experimental:4.1.8"){
exclude group: 'xpp3', module: 'xpp3'
}
}
}
also, my libs folder is empty. I don't use jar-files
Link to Smack-Wiki https://github.com/igniterealtime/Smack/wiki/Smack-4.1-Readme-and-Upgrade-Guide#using-eclipses-android-development-tools-adt-ant-based-build
Please, help, I loose two days on fixing it
I was also facing the same issue.
Try adding the following dependency:
compile 'com.android.support:multidex:1.0.1'
and in your application class add this,
#Override
protected void attachBaseContext(Context base)
{
super.attachBaseContext(base);
MultiDex.install(BaseApplication.this);
}
in my application i want to use this below pasted code as PicassoCache, but after use that such as :
PicassoCache.getPicassoInstance(context)
.load(list.get(position).getStoreImage())
.placeholder(R.drawable.ic_messages)
.into(holder.store_avatar);
i get this error:
Could not find class 'com.squareup.okhttp.CacheControl$Builder', referenced from method com.squareup.picasso.OkHttpDownloader.load
06-12 01:13:17.484 6246-6246/ir.pishguy.signalpresentationproject E/AndroidRuntime: FATAL EXCEPTION:
main java.lang.NoClassDefFoundError: com.squareup.okhttp.OkHttpClient
PicassoCache:
import com.squareup.picasso.Downloader;
import com.squareup.picasso.OkHttpDownloader;
import com.squareup.picasso.Picasso;
public class PicassoCache {
private static Picasso picassoInstance = null;
private PicassoCache(Context context) {
Downloader downloader = new OkHttpDownloader(context, Integer.MAX_VALUE);
Picasso.Builder builder = new Picasso.Builder(context);
builder.downloader(downloader);
picassoInstance = builder.build();
}
public static Picasso getPicassoInstance(Context context) {
if (picassoInstance == null) {
new PicassoCache(context);
return picassoInstance;
}
return picassoInstance;
}
}
My gradle:
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'android-command'
apply plugin: 'realm-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "ir.pishguy.signalpresentationproject"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
command {
events 2000
}
lintOptions {
disable 'InvalidPackage'
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
ext {
supportLibVersion = '23.4.0'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:support-v4:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile 'com.squareup.picasso:picasso:2.5.2'
compile('io.socket:socket.io-client:0.7.0')
{
// excluding org.json which is provided by Android
exclude group: "org.json", module: "json"
}
compile ('com.squareup.retrofit2:retrofit:2.0.2'){
exclude module:'okhttp'
}
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.github.devlight.navigationtabbar:library:+'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile "de.hdodenhof:circleimageview:2.0.0"
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
compile "com.balysv:material-ripple:1.0.2"
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.github.chyrta:AndroidOnboarder:+'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:multidex:1.0.1'
}
For me combination
// Retrofit
compile('com.squareup.retrofit2:retrofit:2.0.2') {
exclude module: 'okhttp'
}
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
// Picasso
compile 'com.squareup.picasso:picasso:2.5.2'
works well, but here some answers said that
compile 'com.squareup.okhttp:okhttp-urlconnection:x.x.x'
may help.
Try the following combination, it's working for me :
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
Hope it will work for you :)
I have the following issue when run my application using android studio
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 5120 MB.
To do this set org.gradle.jvmargs=-Xmx5120M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
:_4SaleApp:validateDebugSigning
:_4SaleApp:packageDebug
:_4SaleApp:zipalignDebug
:_4SaleApp:fullDebugBuildInfoGenerator
:_4SaleApp:assembleDebug
can any one tell me how to solve this problem ?
EDIT
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.mutualmobile.gradle.plugins:dexinfo:0.1.2'
}
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.forsale.forsale"
minSdkVersion 15
targetSdkVersion 15
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'lib/armeabi-v7a/libblasV8.so'
}
dexOptions {
incremental true
javaMaxHeapSize "10g"
}
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDirs = ['libs']
}
}
productFlavors {
}
/*lintOptions {
checkReleaseBuilds false
abortOnError false
}*/
}
repositories {
jcenter()
maven {
url 'https://zendesk.artifactoryonline.com/zendesk/repo/'
}
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
maven {
url "https://jitpack.io"
}
maven {
url "http://appboy.github.io/appboy-android-sdk/sdk"
}
maven {
url 'https://zendesk.artifactoryonline.com/zendesk/repo'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':gestureimageview')
compile project(':ffmpeg4android_lib')
compile 'com.android.support:multidex:1.0.0'
compile files('libs/universal-image-loader-1.9.5.jar')
compile files('libs/android-hipmob-2.9.8.jar')
compile files('libs/HockeySDK-3.5.0.jar')
compile files('libs/httpclient-4.3.jar')
compile files('libs/httpcore-4.3.jar')
compile files('libs/libphonenumber-5.2v1.5.jar')
compile files('libs/NineOldAndroid-2.4.0.jar')
compile files('libs/org.apache.commons.io.jar')
compile files('libs/zbar.jar')
compile files('libs/quickblox-android-sdk-core-2.5.jar')
compile files('libs/quickblox-android-sdk-chat-2.5.jar')
compile files('libs/quickblox-android-sdk-content-2.5.jar')
compile files('libs/quickblox-android-sdk-messages-2.5.jar')
compile files('libs/renderscript-v8.jar')
compile('com.appboy:android-sdk-ui:1.11.2') {
exclude group: 'com.android.support', module: 'multidex'
}
compile group: 'com.zendesk', name: 'sdk', version: '1.6.0.1'
compile 'com.zopim.android:sdk:1.1.0'
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.github.jaydeepw:poly-picker:v1.0.22'
compile 'com.github.bmelnychuk:atv:1.2.+'
compile 'com.wdullaer:materialdatetimepicker:2.0.2'
compile 'com.danikula:videocache:2.3.4'
compile 'com.instabug.library:instabug:2.+'
//compile 'com.google.android.gms:play-services:8.3.0'
//compile 'com.google.android.gms:play-services-ads:8.3.0'
//compile 'com.google.android.gms:play-services-auth:8.3.0'
//compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:support-v4:23.2.1'
}
Look my ScreenShot and add this line :
On build.gradle() add
android {
...
dexOptions {
javaMaxHeapSize "3g"
}
..
}
And on gradle.properties add
org.gradle.jvmargs=-Xmx5120M
I write some library, which has a portion of UI. Also, this library uses another libraries.
I want to provide release .aar to use this portion of UI in any App.
My library has next dependecies:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//Http communication, websockets, etc.
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
//Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
//Unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
//Other
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
//Reactive programmnig
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
When I built .aar everything is fine, but when I inlude this .aar into another app, I have next problems:
1). ./gradlew clean build
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
:app:processDebugResources FAILED
Solution is very simple - add to MainApp/app/build.gradle next line:
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
2). When I run MainApp getting this error:
java.lang.NoClassDefFoundError: com.my.sdk.ui.fragment.DialogAppNotInstalledFragment
To solve this I need to add compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0' to MainApp/app/build.gradle.
Same to other dependecies.
In the result I need just copy-paste all my dependecies from my library project to MainApp project.
Is it possible to make library aar contain all necessery dependecies?
build.gradle of library:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
//apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "0.0.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
dexOptions {
preDexLibraries = false
incremental true
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
lintOptions {
abortOnError false
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//Http communication, websockets, etc.
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
//Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
//Unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
//Other
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
//Reactive programmnig
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
}
// To publish to maven local execute "gradle clean build publishToMavenLocal"
// To publish to nexus execute "gradle clean build publish"
android.libraryVariants
publishing {
publications {
maven(MavenPublication) {
artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"
artifactId = POM_ARTIFACT_ID
groupId = GROUP
version = VERSION_NAME
// Task androidSourcesJar is provided by gradle-mvn-push.gradle
//artifact androidSourcesJar {
// classifier "sources"
//}
}
}
repositories {
maven {
credentials {
username System.getenv('NEXUS_USER_NAME')
password System.getenv('NEXUS_PASSWORD')
}
url "http://my-nexus-url/"
}
}
}
MainApp/app/build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://my-nexus-url/' }
flatDir {
dirs 'libs'
}
}
android {
signingConfigs {
some_config {
keyAlias 'some alias'
keyPassword '741789654uppy'
storeFile file('../my-keystore.jks')
storePassword 'some_password'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.company.app.android"
minSdkVersion 14
targetSdkVersion 23
versionCode 9
versionName "1.0.0"
}
dexOptions {
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.some_config
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile files('libs/StartAppInApp-2.3.1.jar')
// compile files('libs/android-support-v4.jar')
compile files('libs/applovin-sdk-5.2.0.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
//here is my library!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
compile('com.my.sdk:SDK:0.0.1#aar'){
transitive = true;
exclude(group:'android.support', module: 'support-v4')
}
//***********************************************
//Dependecies from library
//***********************************************
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.android.support:appcompat-v7:23.1.1'
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//************************************************
}
UPDATE
Generated POM file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.my.sdk</groupId>
<artifactId>SDK</artifactId>
<version>0.0.1</version>
<packaging>aar</packaging>
</project>
If anybody have the same problem, you may obtain correct answer here
Result build.gradle is:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "0.0.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
dexOptions {
preDexLibraries = false
incremental true
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
lintOptions {
abortOnError false
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//Http communication, websockets, etc.
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
//Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
//Unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
//Other
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
//Reactive programmnig
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
}
// To publish to maven local execute "gradle clean build publishToMavenLocal"
// To publish to nexus execute "gradle clean build publish"
android.libraryVariants
publishing {
publications {
maven(MavenPublication) {
artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"
artifactId = POM_ARTIFACT_ID
groupId = GROUP
version = VERSION_NAME
pom.withXml {
def depsNode = asNode().appendNode('dependencies')
configurations.compile.allDependencies.each { dep ->
if(dep.name != null && dep.group != null && dep.version != null) {
def depNode = depsNode.appendNode('dependency')
depNode.appendNode('groupId', dep.group)
depNode.appendNode('artifactId', dep.name)
depNode.appendNode('version', dep.version)
//optional add scope
//optional add transitive exclusions
}
}
}
}
}
repositories {
maven {
credentials {
username System.getenv('NEXUS_USER_NAME')
password System.getenv('NEXUS_PASSWORD')
}
url "http://nexus-repository-url/"
}
}
}