Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25771] Android: Apps fail to build as of 7.0.2 if system requires proxy to access Internet

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-02-28T19:42:54.000+0000
Affected Version/sRelease 7.0.2
Fix Version/sRelease 7.1.0
ComponentsAndroid
Labelsandroid, build, proxy
ReporterJoshua Quick
AssigneeJoshua Quick
Created2018-02-12T21:20:18.000+0000
Updated2018-10-02T15:37:37.000+0000

Description

*Summary:* If the developer's system uses a proxy to access the Internet, then Android apps will fail to build as of Titanium 7.0.2. *Steps to Reproduce:*

Delete the following folder on Mac, if it exists: ~/.gradle/caches

Set up the machine to access the Internet via a proxy.

Configure the proxy settings in Appcelerator Studio via its "Proxy Setup" window or via the CLI's "appc config set proxyServer".

Attempt to do an Android build.

*Result:* The build fails with follow logged errors...
[ERROR] Failed to run dexer:
[ERROR]   
[ERROR] FAILURE: Build failed with an exception.
[ERROR]   
[ERROR] * What went wrong:
[ERROR] A problem occurred configuring root project 'android'.
[ERROR] > Could not resolve all files for configuration ':classpath'.
[ERROR]    > Could not resolve net.sf.proguard:proguard-gradle:5.3.3.
[ERROR]      Required by:
[ERROR]          project :
[ERROR]       > Could not resolve net.sf.proguard:proguard-gradle:5.3.3.
[ERROR]          > Could not get resource 'https://repo1.maven.org/maven2/net/sf/proguard/proguard-gradle/5.3.3/proguard-gradle-5.3.3.pom'.
[ERROR]             > Could not GET 'https://repo1.maven.org/maven2/net/sf/proguard/proguard-gradle/5.3.3/proguard-gradle-5.3.3.pom'.
[ERROR]                > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR]   
[ERROR] * Try:
[ERROR] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ERROR]   
[ERROR] * Get more help at https://help.gradle.org
[ERROR]   
[ERROR] BUILD FAILED in 1s
*Cause:* A new "gradle" build step has been added to Titanium 7.0.2 to perform ProGuard and multidexing apps. Gradle is failing to download its module(s) from maven repositories since it is not configured to work through a proxy. *Recommended Solution:* Developers currently have to configure Titanium/Appc to use a proxy according to our docs here... http://docs.appcelerator.com/platform/latest/#!/guide/Using_Studio_From_Behind_a_Proxy http://docs.appcelerator.com/platform/latest/#!/guide/Appcelerator_CLI_Getting_Started When the Titanium build system generates the "gradle-wrapper.properties" file, it should add the CLI's proxy settings to that gradle property file as well. Gradle documents these proxy settings here... https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy *Work-Around:* Titanium developers can work-around this issue by configuring a global "gradle.properties" file with these proxy settings according to the docs here... https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy On Mac, the global file goes here...
~/.gradle
On Windows, the global file goes here...
C:\Users\<UserName>\.gradle

Comments

  1. Joshua Quick 2018-02-12

    *Set up a temporary proxy server on Mac:*

    Open the Mac "Terminal" app.

    At the command line, enter the following: npm install -g proxy

    At the command line, enter the "Proxy Command Line" shown down below to start the server.

    Open Appcelerator Studio.

    Click menu item "Appcelerator Studio\Preferences".

    Go to preference page "General\Network Connections".

    Click the "Active Provider" drop-down and select "Manual".

    Under "Proxy entries" list, double click on "HTTP".

    Enter host "127.0.0.1", port "3128, user "foo", password "bar", check "Requires Authentication", and click OK.

    Under "Proxy entries" list, double click on "HTTPS".

    Enter host "127.0.0.1", port "3128, user "foo", password "bar", check "Requires Authentication", and click OK.

    Click the Preferences dialog OK button to save the settings.

    Open Mac's "System Preferences" window.

    Click "Network".

    Select the active network connection (in green) on the left.

    Under the "Configure" drop-down box, select "Off" to disconnect.

    Click the "Apply" button.

    Attempt to do an appc build. (It'll do it via the local proxy server.)

    *Proxy Command Line:*
       proxy --authenticate 'if \
           [ "$PROXY_AUTH_USERNAME" = "foo" ] && \
           [ "$PROXY_AUTH_PASSWORD" = "bar" ]; \
             then exit 0; \
           fi; \
           exit 1;'
       
    *Notes:* * To restore Internet access under "System Preferences\Network", change your "Configure" drop-down back "Using DHCP". * To kill the running proxy server at the terminal, press Ctrl-C. * To uninstall the proxy server from the command line (when you're done testing), enter the following at the command line: npm uninstall proxy
  2. Joshua Quick 2018-02-15

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/9822 PR (7.1.x): https://github.com/appcelerator/titanium_mobile/pull/9823
  3. Lokesh Choudhary 2018-02-28

    FR Passed. PR's merged.
  4. Lokesh Choudhary 2018-03-06

    Verified the fix in SDK 7.2.0.v20180305152636 & 7.1.0.v20180306061214. Closing. Studio Ver: 5.0.0.201712081732 OS Ver: 10.13.2 Xcode Ver: Xcode 9.2 Appc NPM: 4.2.12 Appc CLI: 7.0.2 Daemon Ver: 1.0.1 Ti CLI Ver: 5.0.14 Alloy Ver: 1.11.0 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Nexus 6P --- Android 8.0.0
  5. Joshua Quick 2018-10-02

    [~aislam], their issue doesn't sound related to this ticket. The logged error suggests that their network is blocking the following URL... https://repo.maven.apache.org/maven2/net/sf/proguard/proguard-gradle/5.3.3/proguard-gradle-5.3.3.pom This is needed by Google's "gradle" build system to download ProGuard, which Titanium uses to multidex the app if needed. You should ask them to add "https://repo.maven.apache.org" to their white list.

JSON Source