Android Extensions: Allow to access library project resources in Gradle setup (#KT-22430)
This commit is contained in:
+8
-1
@@ -335,7 +335,14 @@ fun getSomething() = 10
|
||||
val options = defaultBuildOptions().copy(incremental = false)
|
||||
|
||||
project.build("assemble", options = options) {
|
||||
assertSuccessful()
|
||||
if (isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
|
||||
// Library dependencies are not supported in older versions of Android Gradle plugin (< 3.0)
|
||||
assertFailed()
|
||||
assertContains("Unresolved reference: layout_in_library")
|
||||
assertContains("Unresolved reference: text_view")
|
||||
} else {
|
||||
assertSuccessful()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -41,4 +41,5 @@ androidExtensions {
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
compile project(":library")
|
||||
}
|
||||
|
||||
+2
@@ -3,11 +3,13 @@ package org.example.manyvariants
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.layout_in_library.text_view
|
||||
|
||||
class MainActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
viewMain
|
||||
text_view
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "25.0.2"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 23
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.library" />
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Library</string>
|
||||
</resources>
|
||||
+1
-1
@@ -1 +1 @@
|
||||
include ':app'
|
||||
include ':app', ':library'
|
||||
Reference in New Issue
Block a user