Skip to content
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

Issue with android M compilesdkversion 23 #231

Closed
rahul-ramanujam opened this issue Nov 3, 2015 · 19 comments
Closed

Issue with android M compilesdkversion 23 #231

rahul-ramanujam opened this issue Nov 3, 2015 · 19 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@rahul-ramanujam
Copy link

I am getting the following gradle error after updating to latest sdk version

Warning:com.parse.ParseApacheHttpClient: can't find referenced method 'org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int,android.net.SSLSessionCache)' >in library class android.net.SSLCertificateSocketFactory

I am using "useLibrary" option in the gradle file to include legacy apache
android {
useLibrary 'org.apache.http.legacy'
}

@grantland
Copy link
Contributor

This seems related to #189. Unfortunately I thought this was only an issue with compiling the SDK with compileSdkVersion = 23, but it's actually a problem using it as well. I'll try to get a fix out soon.

@grantland grantland added the type:bug Impaired feature or lacking behavior that is likely assumed label Nov 3, 2015
@grantland grantland added this to the 1.10.3 milestone Nov 3, 2015
@grantland grantland self-assigned this Nov 3, 2015
@rahul-ramanujam
Copy link
Author

@grantland cool , Thanks

@grantland
Copy link
Contributor

A workaround for now would be to lower the compileSdkVersion as long as you're not using any specific M APIs.

@grantland
Copy link
Contributor

Unfortunately this looks like a deeper problem than I originally thought. We're utilizing some APIs that were completely removed from android-23 that aren't even in the Apache Http Legacy support library:

SSLCertificateSocketFactory.getHttpSocketFactory(socketOperationTimeout, sslSessionCache)

Originally I thought we could use the code that the above method used internally, but it looks like that was no longer exist as well:

public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(
        int handshakeTimeoutMillis, SSLSessionCache cache) {
    return new org.apache.http.conn.ssl.SSLSocketFactory(
            new SSLCertificateSocketFactory(handshakeTimeoutMillis, cache, true));
}

(from https://android.googlesource.com/platform/frameworks/base/+/lollipop-release/core/java/android/net/SSLCertificateSocketFactory.java#158)

The above is necessary to cache SSL sessions and removing it would slow down all requests for all devices utilizing org.apache.http.

Using compileSdkVersion = 22 is still a valid workaround as long as you're not using APIs from android-23.

We'll be looking into completely removing Apache from our codebase pending some testing of whether or not HttpURLConnection works well on android-9 through android-18, which we'll do by the end of the week.

@rahul-ramanujam
Copy link
Author

I am looking into updating the support libraries to the latest version , which require us to update the compileSdkVersion to 23. A tentative date for the fix would help me plan accordingly. Thanks

@grantland
Copy link
Contributor

If everything works smoothly with HttpURLConnection, end of next week.

By the way, I'm trying to reproduce this issue and have tried both running a debug app with compileSdkVersion = 23 and building a signed release, but neither turn up this error. Could you specify some repro steps? /cc @iampawan

@rahul-ramanujam
Copy link
Author

Sounds good . Did you enable

android {
useLibrary 'org.apache.http.legacy'
}

I am using the legacy apache on my project , So had to include this.

@grantland
Copy link
Contributor

Yes I did enable that. Are you pulling in the SDK from source or are you using the compiled jar or Maven Central repository? Are you able to reproduce this issue with the ParseStarterProject?

@rahul-ramanujam
Copy link
Author

I haven't tried the parseStarterProject . I am including the following dependency in gradle for parse

compile 'com.parse:parse-android:1.10.3'

@grantland
Copy link
Contributor

Could you attempt to reproduce this issue with the blank ParseStarterProject and post your repro steps here?

@grantland grantland modified the milestones: 1.10.4, 1.10.3 Nov 5, 2015
@grantland grantland added needs more info and removed type:bug Impaired feature or lacking behavior that is likely assumed labels Nov 5, 2015
@parse-github-bot
Copy link

Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.

Please try the latest SDK. Our release notes have details about what issues were fixed in each release.

In addition, you might find the following resources helpful:

@iampawan
Copy link

iampawan commented Nov 5, 2015

i am using compile 'com.parse:parse-android:1.10.3'
and still getting same error .
How cani use parsestarter?Can u explain

@sichevoi
Copy link

sichevoi commented Nov 5, 2015

Hello Parse team!

I've reproduced the issue with the ParseStarterProject, it only happens with proguard minifyEnabled setting (which is off by default in the starter project).
Please find the failing project sample here: https://github.com/sichevoi/Parse-Starter-Project
It's basically the original starter project with latest compile SDK and build tools + minify.
Note, that I'm actually getting two errors compiling with the latest SDK:

Warning:com.parse.NotificationCompat$NotificationCompatImplBase: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning:com.parse.ParseApacheHttpClient: can't find referenced method 'org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int,android.net.SSLSessionCache)' in library class android.net.SSLCertificateSocketFactory

@grantland
Copy link
Contributor

Thanks for the concise repro steps! I've successfully reproduced this issue and have found a solution.

Could you try updating proguard-rules.pro with the changes from #234 to see if this resolves your issues?

@grantland grantland added type:bug Impaired feature or lacking behavior that is likely assumed and removed needs more info labels Nov 5, 2015
@sichevoi
Copy link

sichevoi commented Nov 6, 2015

Yes, that change resolves the issue.
It's good, that a description is provided, explaining the usage of the methods in question.
And thanks for a quick response!

sichevoi added a commit to sichevoi/Parse-Starter-Project that referenced this issue Nov 6, 2015
@grantland
Copy link
Contributor

Great to hear! much happier that the solution was easier than I originally thought 😄

@rahul-ramanujam
Copy link
Author

I just tried this. It works for me too.

@leonardojobim
Copy link

Is it fixed ?
I am using :

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    useLibrary 'org.apache.http.legacy'

    release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
// ...
}

// ...

compile 'com.facebook.android:facebook-android-sdk:4.10.1'
compile 'com.parse.bolts:bolts-android:1.3.0'
compile 'com.parse:parse-android:1.13.0'
compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'

and the error below continues when generate release apk using proguard:

Warning: com.parse.NotificationCompat$NotificationCompatImplBase: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning: com.parse.ParseApacheHttpClient: can't find referenced method 'org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int,android.net.SSLSessionCache)' in library class android.net.SSLCertificateSocketFactory

@rogerhu
Copy link
Contributor

rogerhu commented Mar 7, 2017

setLatestEventInfo() has also been deprecated.

It would have to be something like:

      Notification result = b.setContentTitle(b.mContentTitle)
              .setContentText(b.mContentText)
      .setContentIntent(b.mContentIntent).build();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

7 participants