-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Document proguard rules #58
Comments
Lint also apparently fails. Sigh.
|
Here is how I fixed the Lint error (actually is just a workaround): compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.squareup.okhttp:okhttp-urlconnection:2.0.0') {
exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
compile('com.squareup.okhttp:okhttp:2.0.0') {
exclude group: 'com.squareup.okio', module: 'okio'
} And with <lint>
<issue id="InvalidPackage">
<ignore path="libs/okio-1.0.0.jar"/>
</issue>
</lint> |
I'm using Retrofit with OkHttp and I'm also seeing this. It's a shame as I like to maintain "lint zero". The okhttp exclude in the build.gradle method above gives me this at runtime: "java.lang.NoClassDefFoundError: com.squareup.okhttp.internal.http.RetryableSink" so I tried this in build.gradle
But that does not stop the lint error. I ended up adding it to lint.xml as a global rule which isn't ideal but does the job.
|
If you don't want to ignore <issue id="InvalidPackage">
<ignore regexp="okio-1.0.0.jar" />
</issue> |
I too am suffering with this lint failure which adds an ugly red smear to my lint report :) |
Same problem. +1 |
Just started getting this as of today. Haven't had this problem for months before. |
If you're using Gradle, it's definitely a hacky solution, but you can completely disable the linting for invalid packages by adding: lintOptions {
disable 'InvalidPackage'
} to your This should definitely get fixed at the |
Fixed how? There's nothing wrong with it. |
Not being able to build without turning off linting for invalid packages means something is wrong. Maybe this is something that needs to get fixed in Gradle and not at your level - is there a way to specify at the repo or pom level that a certain package doesn't need to be checked for on Android? |
No. You can file a feature request for something like that on http://b.android.com though. |
I will - is there any way to add documentation here or at the Retrofit level for this workaround on android since it is a known issue? |
See, the problem I have is that even with proguard and linting rules, this problem still occurs in this situation: Project A is main project in Android Studio Module B is a module I have (a library) that for testing, is imported locally via this way in A's settings.gradle: project(':foo').projectDir = new File(settingsDir,'/path/to/module') Then project A has this dependency: complile project(:foo) If module B has okio dependencies, and I run a ./gradlew clean build from project A, as of 0.8.6 the errors will prevent the entire project from being build correctly. This was entirely untrue in the past (as my previous comment mentioned). However I think this is an issue with the new proguard implementation of AS, given that proguard simply isn't ran on module B during this build step regardless of the settings. So, in developing a library dependent on okio, its quite frustrating. But, it all works fine I suppose, I just have to build from the 'correct' locations now. Merely an inconvenience, and nothing to 'fix'. |
At the very least this case should probably be a lint warning, not an error. Perhaps they're not interested in that granular of parsing for what is happening here. In Okio's case, it's impossible to link against these methods in your code therefore it's impossible to cause harm to your application (unless you are using reflection and trying to invoke it). |
I certainly agree that I would expect this to be a warning, not an error. But for right now, this is getting recognized by It would be helpful to have a documented workaround if this is an issue out of control of the okio/Square team. |
Rather than disabling the lint check you can change its severity. lintOptions {
warning 'InvalidPackage'
} This way it will still show up in lint results with a warning. |
Lint does complain that Okio is an invalid package square/okio#58
Lint does complain that Okio is an invalid package square/okio#58
to keep it as an error and ignore okio's jar file. |
... transitive dependency okio For more information, see square/okio#58
Closed by #275? Regarding Android lint, seems #58 (comment) is the best workaround as it disables the error only for this lib. Could this be added to the README? |
Is there a plan to fix the lint part of this issue? You may consider offering a separate build of the library for Android, that doesn't contain the non-Android java.nio.file.Path class. |
No. Android O will have this class anyway.
…On Sun, Mar 19, 2017, 6:31 PM Noam Tamim ***@***.***> wrote:
Is there a plan to fix the *lint* part of this issue? You may consider
offering a separate build of the library for Android, that doesn't contain
the non-Android java.nio.file.Path class.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#58 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEfUz2nW1Luuh7J-bk-mVXfXKrI70ks5rnayjgaJpZM4B_2u1>
.
|
…ofit square/okio#58, also fixed some minor linting issues
…mment) (#321) Signed-off-by: digitaldan <[email protected]>
I tried to do this here: #268. |
We have a ProGuard section on our main readme now. |
Our users are running into problems with java.nio.file.Path. We have proguard rules that help to work around this. We should document 'em.
See also #42
The text was updated successfully, but these errors were encountered: