Can't use Droidparts' ClearableEditText - android

I'm trying to use ClearableEditText as stated in the Droidparts official doc :
<org.droidparts.widget.ClearableEditText
android:drawableRight="#android:drawable/ic_action_remove"
android:drawablePadding="12dp" />
But the component is not found, I get this error at runtime :
java.lang.ClassNotFoundException: Didn't find class "org.droidparts.ClearableEditText"
I'm importing the dependency like this :
compile 'org.droidparts:droidparts:3.2.5'
I looked at the content of the JAR and I don't find the "widget" folder.
Is the component not available anymore or am I doing something wrong ?

Got it, ClearableEditText belongs to :
'org.droidparts:droidparts-misc:3.2.5'
insead of
'org.droidparts:droidparts:3.2.5'

Related

Android Xamarin AAR Binding enclosing type

I have an .aar third party library that I want to use in Xamarin Android. So I created a new Android Bindings Library, added the aar-library and changed the Build action of the aar file to LibraryProjectZip like described here: https://learn.microsoft.com/en-us/xamarin/android/platform/binding-java-library/binding-an-aar
Nothing else was changed and I would expect the project to compile and generate a dll file.
Instead I get a lot of errors saying Error CS0542 'xy': member names cannot be the same as their enclosing type.
When I jump to the origin of the error, I find the errors in generated code by Visual Studio with the classes looking something like:
public abstract class Albumin : Java.Lang.Object {
internal Albumin ()
{
}
// (removed for readability)
[Register ("ALBUMIN")]
public const string Albumin = (string) "albumin";
I cannot modify the source code of the library.
What can I do in order to build the Binding Library successfully?
Thank you very much #Leo Zhu for the answer in the comments:
The solution is Renaming Members.
So in my case the Metadata.xml in die Binings Library would look like the following:
<attr path="/api/package[#name='com.company.android.sdk.dataclass']/interface[#name='DataClass.Albumin']/field[#name='ALBUMIN']" name="name">ALBUMIN_Binding</attr>

Android Source Code Compilation issue

i am working on one of C++ Application, where i need to interface with Android Source Code, i got this Source Code from below URL
https://github.com/android
Now When i am Compiling my application which uses Camera module, then it has many dependencies like utils,binder,gui,system. by this way i am including every header files which camera module of Android depends depends on.
but i am stuck with following error:
In file included from jni/headers/camera/ICamera.h:22:0,
from jni/headers/MyCamera.h:4,
from jni/headers/VideoWrapper.h:4,
from jni/src/com_example_jnitest_VideoJava.cpp:2
jni/headers/binder/Parcel.h:31:7: error: template argument
required for 'class Flattenable'
class Flattenable;
^
jni/headers/binder/Parcel.h:105:37: error: invalid use of
template-name 'android::Flattenable' without an argument list
status_t write(const Flattenable& val);
^
jni/headers/binder/Parcel.h:160:30: error: 'Flattenable' is not a type
status_t read(F
my Question is:How to get out of this error??
Whenever Any class Template need to be pre-declaration in another class or Anywhere then we need to give it with template
e.g:
in Parcel.h file of Android source, pre-declaration of class Flattenable is done as below:
class Flattenable;
but actually it should be:
template <typename T> class Flattenable;
because class Flattenable is Template class.
However i Amazed how this things not taken care into Android Source Code..!!

eclipse doesn't show xml errors in preference xml

I copied several classes from library to the project itself.
In my values/xml/preferences.xml I have some custom classes such as CustomListPreference etc...
Problem is that those custom classes were in my library (com.udios.commons) and now they are in my project itself (com.udios.test)
in the preference xml they are still begin with:
com.udios.commons.CustomListPreference ..... />
and this library doesn't exist anymore. Eclipse doesn't show any error and I've notice to this issue only when the app crashed.
How can I fix it? Thanks for the help.
How can I fix it?
If the class CustomListPreference has chaged from the library to your project, you must change to the new package that contains the class
com.udios.commons.CustomListPreference ..... />
for example if your class is now inside the folders structure:
/com/mypackage/udi/CustomListPreference.java
change the references to :
com.mypackage.udi.CustomListPreference ..... />

Monodroid issue with jar binding zubhium sdk

Iam trying to bind a jar(zubhium sdk jar) file to my mono droid project. I have followed their guide on xamarins website and created a new binding project which I reference I my mono droid project.
I am having some issues with package names. I get the following error:
Error 3 package com.zubhium.interfaces does not exist
com.zubhium.interfaces.ZubhiumListener
C:\Users\jbp\Desktop\ny\CmsApp.Droid\obj\Debug\android\src\mono\com\zubhium\interfaces\ZubhiumListenerImplementor.java 8 25 CmsApp.Droid
from the genrated source:
package mono.com.zubhium.interfaces;
public class ZubhiumListenerImplementor
extends java.lang.Object
implements
mono.android.IGCUserPeer,
com.zubhium.interfaces.ZubhiumListener
And that is because when the project is wrapped it automaticly adds mono(.com.zubhium....) to the package name. I cant find how to remove this mono or if i can set a rule to add this part.
I tried to put <attr path="/api/package[#name='com.zubhium.interfaces']" name="managedName">mono.com.zubhium.interfaces</attr>
in the xmldata.xml file but that did not work.
Do you guys have any sugestions?
Regards
package com.zubhium.interfaces does not exist
When you bind a .jar library and reference the binding project from another project, you need to also add the .jar to your Application project and set its Build action to AndroidJavaLibrary.
Failure to do so means that the .jar won't be added to the javac $CLASSPATH, resulting in javac compilation errors when compiling the Android Callable Wrapper (as you saw), and that the .jar won't included into your final .apk. Both of these are Badâ„¢.
And that is because when the project is wrapped it automaticly adds mono(.com.zubhium....) to the package name.
That's for an "Implementor" type; you can ignore it. It's used as part of the implementation of events. If you look at the generated C# code, there should be:
[global::Android.Runtime.Register ("mono/com/zubhium/interfaces/ZubhiumListenerImplementor")]
internal sealed class ZubhiumListenerImplementor : Java.Lang.Object, IZubhiumListener {
// ...
}
The mono.com.zubhium.interfaces.ZubhiumListenerImplementor is the ACW for the internal ZubhiumListenerImplementor type.
You can't rename this type; it's an internal construct that isn't controlled via metadata.

Android Annotations framework doesn't seem to generate anything

I'm trying to use Android annotations framework because it seems quite powerful. I'm quite stuck to configuring my first project based on it.
I followed every step of the wiki but it doesn't generate any file after a build.
So when I ask for a generated class from the manifest:
<activity android:name=".MyActivity_"
android:label="#string/app_name">
I get an exception:
java.lang.ClassNotFoundException
My activity is exactly the same one as in the wiki:
#EActivity(R.layout.main)
public class MyActivity extends Activity {
#ViewById
EditText myInput;
#ViewById(R.id.myTextView)
TextView textView;
#Click
void myButton() {
String name = myInput.getText().toString();
textView.setText("Hello "+name);
}
}
Any ideas?
EDIT: Just found out a directory ".apt_generated" is made but it's empty after the build.
This seems to be an AndroidAnnotations bug, and should be reported on the dedicated bug tracker, here : http://code.google.com/p/androidannotations/issues/entry . You could also use the AndroidAnnotations mailing list, http://groups.google.com/group/androidannotations
First, I have a few questions :
Which IDE do you use : Eclipse, Netbeans, IntelliJ ? Which version ?
Do you use Maven, Ant, or only your IDE to build the project ?
Your problem may be due to a few things : annotation processing not triggered, a bug in AA, or the files generated in a folder not part of the classpath.
In Eclipse, you may get more information from the "Window > Show View > Error Log" view. If annotation processing is triggered, you should see some messages about AndroidAnnotations.
For other people who are running into this and the leading answer doesn't work, run a build and then search for the file androidannotations.log somewhere in the project. This log file is generated and may hint at what is wrong.
For me, it had a warning message that it could not locate AndroidManifest.xml. Though this seemed like just a warning, it was actually the cause of the error... Not finding my AndroidManifest.xml file resulted in it not generating some of the classes it should have.
Check if you have the xml file. If not, the solution is obvious. If you do have it, the typical reason AA cannot find the file is because it is in a non-standard location -- AA recursively checks the parent directories above where it generates files for this xml file and will fail if it's not there. In my case, my AndroidManifest.xml was located in [project root]/app/src/main which is not a direct ancestor folder so that was the problem.
You can specify where your xml file is in your project build.gradle:
android {
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
arguments = ["androidManifestFile": "specify_location_of_AndroidManifest.xml_here"]
}
}
}
}

Categories

Resources