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

custom java class #1177

Closed
erhuabushuo opened this issue Nov 22, 2017 · 1 comment
Closed

custom java class #1177

erhuabushuo opened this issue Nov 22, 2017 · 1 comment
Milestone

Comments

@erhuabushuo
Copy link

erhuabushuo commented Nov 22, 2017

java_classes/MyWebViewClient.java

package com.custom.webview;

import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.SslErrorHandler;
import android.net.http.SslError;

public class MyWebViewClient extends WebViewClient {

    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
        handler.proceed(); // Ignore SSL certificate errors
    }

}

buildozer.spec

android.add_src =%(source.dir)s/java_classes/*.java

main.py

MyWebViewClient = autoclass('com.custom.webview.MyWebViewClient')

after build it, I got com.custom.webview.MyWebViewClient not found error

@inclement inclement added this to the 0.7 milestone Nov 24, 2017
@inclement
Copy link
Member

I'm not sure what's wrong, but it's probably something to do with the place the java source is copied to either being wrong, or being not what you expect. You can find the android distribution that has been built at (I think) .buildozer/platform/android/dists/yourdistname, then the java directory is src unless you're using a newer SDK (which would require python-for-android master). Can you find your java files in there, and is the java directory structure what you'd expect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants