Xamarin绑定问题:找不到符号

时间:2018-02-08 14:54:37

标签: c# xamarin binding xamarin.android java-binding

我试图绑定本机Java库。此jar文件先前已集成到绑定项目中,我正在尝试使用最新版本更新jar。

我在构建期间遇到以下问题:

1>obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java:81: error: cannot find symbol
1>  public void deferredAuthorization (boolean p0, boolean p1, com.creditcall.cardeasemobile.DeferredAuthorizationReason p2)
1>                                                                                          ^
1>  symbol:   class DeferredAuthorizationReason
1>  location: package com.creditcall.cardeasemobile
1>obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java:86: error: cannot find symbol
1>  private native void n_deferredAuthorization (boolean p0, boolean p1, com.creditcall.cardeasemobile.DeferredAuthorizationReason p2);
1>                                                                                                    ^
1>  symbol:   class DeferredAuthorizationReason
1>  location: package com.creditcall.cardeasemobile

1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(81,90): javac.exe error :  error: cannot find symbol
        1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(81,90): javac.exe error :    public void deferredAuthorization (boolean p0, boolean p1, com.creditcall.cardeasemobile.DeferredAuthorizationReason p2)
        1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(81,90): javac.exe error :   symbol:   class DeferredAuthorizationReason
        1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(81,90): javac.exe error :   location: package com.creditcall.cardeasemobile
        1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(81,90): javac.exe error : 
        1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(86,100): javac.exe error :  error: cannot find symbol
        1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(86,100): javac.exe error :   private native void n_deferredAuthorization (boolean p0, boolean p1, com.creditcall.cardeasemobile.DeferredAuthorizationReason p2);
        1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(86,100): javac.exe error :   symbol:   class DeferredAuthorizationReason
        1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(86,100): javac.exe error :   location: package com.creditcall.cardeasemobile
        1>D:\repo\a\Payment\obj\Debug\android\src\md5590cc678a2a3d84b78a3968f92c9e08f\cemListener.java(86,100): javac.exe error : 
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(81,90): javac.exe error :  error: cannot find symbol
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(81,90): javac.exe error :  public void deferredAuthorization (boolean p0, boolean p1, com.creditcall.cardeasemobile.DeferredAuthorizationReason p2)
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(81,90): javac.exe error :   symbol:   class DeferredAuthorizationReason
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(81,90): javac.exe error :   location: package com.creditcall.cardeasemobile
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(81,90): javac.exe error : 
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(86,100): javac.exe error :  error: cannot find symbol
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(86,100): javac.exe error :     private native void n_deferredAuthorization (boolean p0, boolean p1, com.creditcall.cardeasemobile.DeferredAuthorizationReason p2);
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(86,100): javac.exe error :   symbol:   class DeferredAuthorizationReason
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(86,100): javac.exe error :   location: package com.creditcall.cardeasemobile
        1>D:\repo\a\Payment\obj\Debug\android\src\mono\com\creditcall\cardeasemobile\ICardEaseMobileListenerImplementor.java(86,100): javac.exe error : 

我可以在cemListener.java上看到这些方法:

    public void deferredAuthorization (boolean p0, boolean p1, com.creditcall.cardeasemobile.DeferredAuthorizationReason p2)
    {
        n_deferredAuthorization (p0, p1, p2);
    }

    private native void n_deferredAuthorization (boolean p0, boolean p1, com.creditcall.cardeasemobile.DeferredAuthorizationReason p2);

我可以看到DeferredAuthorizationReason存在且具有可从我的C#文件访问的值。似乎绑定有效吗?我认为问题是cemListener.java由于某种原因无法看到DeferredAuthorizationReason

我认为我需要对Metadata.xml进行更改,但我不确定需要什么,因为问题似乎是在java文件而不是C#中。

这是api.xml中的类:

<class abstract="false" 
           deprecated="not deprecated" 
           extends="java.lang.Enum" 
           extends-generic-aware="java.lang.Enum&lt;com.creditcall.cardeasemobile.DeferredAuthorizationReason&gt;" 
           final="true" 
           name="DeferredAuthorizationReason" 
           static="false" 
           visibility="public">

        <method abstract="false" 
                deprecated="not deprecated" 
                final="false" 
                name="valueOf" 
                native="false" 
                return="com.creditcall.cardeasemobile.DeferredAuthorizationReason" 
                static="true" 
                synchronized="false" 
                visibility="public">

            <parameter name="p0" 
                       type="java.lang.String">
            </parameter>

        </method>

        <method abstract="false" deprecated="not deprecated" final="false" name="values" native="false" return="com.creditcall.cardeasemobile.DeferredAuthorizationReason[]" static="true" synchronized="false" visibility="public">
        </method>

        <field deprecated="not deprecated" final="true" name="CommunicationFailed" static="true" transient="false" type="com.creditcall.cardeasemobile.DeferredAuthorizationReason" type-generic-aware="com.creditcall.cardeasemobile.DeferredAuthorizationReason" visibility="public" volatile="false">
        </field>

        <field deprecated="not deprecated" final="true" name="ConnectionFailed" static="true" transient="false" type="com.creditcall.cardeasemobile.DeferredAuthorizationReason" type-generic-aware="com.creditcall.cardeasemobile.DeferredAuthorizationReason" visibility="public" volatile="false">
        </field>

        <field deprecated="not deprecated" final="true" name="None" static="true" transient="false" type="com.creditcall.cardeasemobile.DeferredAuthorizationReason" type-generic-aware="com.creditcall.cardeasemobile.DeferredAuthorizationReason" visibility="public" volatile="false">
        </field>

        <field deprecated="not deprecated" final="true" name="ProcessingFailed" static="true" transient="false" type="com.creditcall.cardeasemobile.DeferredAuthorizationReason" type-generic-aware="com.creditcall.cardeasemobile.DeferredAuthorizationReason" visibility="public" volatile="false">
        </field>

    </class>

我可以看到其他枚举似乎不会导致问题,除了此文件为static="false"之外,我无法看到与此类似的不同。

我已尝试在Metadata.xml中对此进行修改,但它似乎没有产生影响:

<attr path="/api/package[@name='com.creditcall.cardeasemobile']/class[@name='DeferredAuthorizationReason']" name="static">true</attr>

0 个答案:

没有答案