Skip to content

Update dependent library versions #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ java/**/build/
android/build/
build/
common/build/
.idea/
*.iml
local.properties

33 changes: 17 additions & 16 deletions android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,29 @@ Android SDK Tools: https://developer.android.com/sdk/index.html#Other
Set the ANDROID_HOME environment variable to the root of the SDK.

Install the following packages:
* Tools/Android SDK Build-tools (Rev. 21.1.2)
* Android 5.1 (API 22)
* Tools/Android SDK Build-tools (Rev. 29.0.2)
* Android 10 (API 29)
* Extras/Android Support Library

Gradle (latest version):
https://services.gradle.org/distributions/gradle-2.3-bin.zip

Note: Additionally you must take care to avoid having multiple versions of
Gradle on your path, as this can cause problems.
Note: It is recommended to always use the included [Gradle Wrapper Scripts] to invoke Gradle to
avoid issues which may be caused by having multiple versions of Gradle on your PATH.


## Building and Running

After installing all the prerequisites, check that everything is working by
running:

$ gradle build
`$ gradlew build`

With an Android emulator running or an Android device connected, the following
command line then builds the library and runs the tests:

$ gradle connectedAndroidTest
`$ gradlew connectedAndroidTest`

The test runner logs to the system log, which can be viewed using logcat:

$ adb logcat
`$ adb logcat`

# Integrating with Android Apps

Expand Down Expand Up @@ -72,7 +69,7 @@ $ adb logcat

i. In activity_main.xml add:

```
```xml
<LinearLayout
android:id="@+id/addresswidget"
android:layout_width="match_parent"
Expand All @@ -82,7 +79,7 @@ $ adb logcat

ii. In MainActivity.java add the following import statements:

```
```java
import android.view.ViewGroup;

import com.android.i18n.addressinput.AddressWidget;
Expand All @@ -93,19 +90,21 @@ $ adb logcat

iii. Define the widget on the object scope

`private AddressWidget addressWidget;`
```java
private AddressWidget addressWidget;
```

iv. Add the widget to the ViewGroup
```
```java
ViewGroup viewGroup = (ViewGroup) findViewById(R.id.addresswidget);
FormOptions defaultFormOptions = new FormOptions();
ClientCacheManager cacheManager = new SimpleClientCacheManager();
this.addressWidget = new AddressWidget(this, viewGroup, defaultFormOptions, cacheManager);
```

Example:
#### Example:

```
```java
package com.example.google.widgetdemo;

import android.support.v7.app.AppCompatActivity;
Expand All @@ -132,3 +131,5 @@ public class MainActivity extends AppCompatActivity {
}
}
```

[Gradle Wrapper Scripts]: https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:using_wrapper
46 changes: 13 additions & 33 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,33 @@
* limitations under the License.
*/

buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}

apply plugin: 'com.android.library'

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs += ["-Xlint:deprecation", "-Xlint:unchecked"]
}

dependencies {
compile project(':common')
compile 'com.google.android.gms:play-services-location:10.0.0'
compile 'com.google.android.gms:play-services-places:9.2.0'
api project(':common')
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.guava:guava:29.0-android'

}

android {
/*
* If these are modified, update the README to reflect the new versions and
* update any related settings in the AdroidManifest.xml file.
*
* NOTE: Because the 'buildToolsVersion' directive only matches an exact
* release (rather than allowing wildcards) and Android remove older
* versions of the build tools very soon after a new revision is made
* available, we must never use the lastest major version of the build
* tools here (because it will quickly be superceded and become unavailable
* to anyone using a fresh install of the SDK). The "final" release of the
* previous major version remains available for much longer however, so as
* a workaround we always use that.
* If these are modified, update the README to reflect the new versions.
*
* So when the build tools version 23.0.0 is released, the buildToolsVersion
* below should be bumped to the last released version of the 22.x.x series.
*
* The obvious way to fix this would be allow wildcards (ie, "22.+") but
* Android have explicitly said that they won't do this.
* NOTE: As of Gradle Android Plugin version 3.0 it is no longer necessary to explicitly
* specify the version of Android Build Tools using the 'buildToolsVersion' setting, unless
* explicitly overriding the default version selected by the Android Plugin. See
* https://developer.android.com/studio/releases/gradle-plugin#3-0-0
*/
compileSdkVersion 22
buildToolsVersion '21.1.2'
compileSdkVersion 29
defaultConfig {
minSdkVersion 17
targetSdkVersion 22
targetSdkVersion 29
}
}

4 changes: 0 additions & 4 deletions android/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="22" />

<!-- Gradle generates an <instrumentation> block during the build process,
but in order to work with other build systems, that don't do that,
there must be such a block declared here. -->
Expand Down
5 changes: 0 additions & 5 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,4 @@
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="22" />
<application/>

</manifest>
14 changes: 12 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,19 @@
/*
* Root Gradle file for Java address input widget (under "common" and "android")
*/
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
}
}

allprojects {
repositories {
mavenCentral()
mavenLocal()
jcenter()
google()
}
}
24 changes: 18 additions & 6 deletions common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,29 @@ http://www.gradle.org/

## Prerequisite dependencies for using Gradle

Gradle (latest version):
https://services.gradle.org/distributions/gradle-2.3-bin.zip
The only prerequisite is a compatible Java Development Kit correctly installed,
with java, javac, and related commands available in your PATH environment.

Note: Additionally you must take care to avoid having multiple versions of
Gradle on your path, as this can cause problems.
This project makes use of the [Gradle Wrapper Scripts] to ensure repeatable builds and use of the
same Gradle version across contributors. Depending on your operating system, Gradle can be invoked
from the root project directory by using either the `gradlew` or `gradlew.bat` command from your
preferred shell environment.

Note: It is recommended to always use the included wrapper scripts to invoke Gradle to
avoid issues which may be caused by having multiple versions of Gradle on your PATH.


## Building and Running

After installing all the prerequisites, check that everything is working by
running:

$ gradle build
$ gradle test
##### On Linux / Unix / Mac
`$ gradlew build`
`$ gradlew test`

##### On Windows
`$ gradlew.bat build`
`$ gradlew.bat test`

[Gradle Wrapper Scripts]: https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:using_wrapper
25 changes: 8 additions & 17 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,14 @@
* limitations under the License.
*/

buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}

apply plugin: 'java'

sourceCompatibility = '1.7'
targetCompatibility = '1.7'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs += ["-Xlint:deprecation", "-Xlint:unchecked"]
}

sourceSets {
Expand All @@ -56,12 +47,12 @@ test {
}

dependencies {
compile 'com.google.guava:guava-gwt:18.0'
implementation 'com.google.guava:guava:29.0-android'
/* Note that gradle will warn about this not being the same version as *
* the Android JSON library (but will not compile if it's removed). */
compile 'org.json:json:20090211'
testCompile 'junit:junit:4.11'
testCompile 'com.google.truth:truth:0.25'
testCompile 'org.mockito:mockito-core:1.9.5'
implementation 'org.json:json:20190722'
testImplementation 'junit:junit:4.13'
testImplementation 'com.google.truth:truth:1.0.1'
testImplementation 'org.mockito:mockito-core:3.3.0'
}

Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public void dataLoadingEnd() {
assertListenerWasCalled(mockListener);
}


@Test public void testSetUrl() {
LookupKey key = new LookupKey.Builder(CANADA_KEY).build();
String url = "http://some-random-url";
Expand Down
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Tue Apr 14 01:10:56 EAT 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Loading