I have Unable to create application im.app.android.core.AppDemoApplication: e3.b: com.pushserver.android.huaweiPushClient cant cast com.myApp.android.push_lib.huawei.HcmPushClient to PushClient error
What proguard rule should I add? I have tried -keep class com.myApp.android.push_lib.** { *; } but after that I just see the blank screen - no crash, just stuck when trying to start.
Not really an answer, but too long for a comment. I'll update this answer in case we make progress.
1. What is the "normal bug"?
can't cast com.myApp.android.push_lib.huawei.HcmPushClient to PushClient
This means that somewhere in your code you are assigning/passing an instance of HcmPushClient to something that is expecting it to be a PushClient. I would assume that PushClient is some class that you defined in your project, but is does not extend from HcmPushClient. Try to find this piece of code and fix it or add it here to your question.
2. What does ProGuard have to do with this?
Actually, I think not much. If ProGuard would create this error, the message would look more like
can't cast com.myApp.android.push_lib.a.b to c
But since all class names in the error message are the original ones, it does not seem like ProGuard is making issues here. BUT: You can still decypher the message a little bit, because this part is obfuscated:
Unable to create application im.app.android.core.AppDemoApplication: e3.b:
e3.b refers to a class that was obfuscated by ProGuard. To find out what class it is, you can check the file /build/outputs/mapping/release/mapping.txt in your project folder. This is a simple text file that stores the information what class name was renamed to what obfuscated name. In this file search for -> e3 to find the class that was renamed to e3. Somewhere close to this line, you should also be able to find out what exactly e3.b is. Could be a method, could also be a member variable or an inner class.
I hope these two points will bring you closer to make the app run.
Related
Class referenced in the manifest, se.linerotech.myapplication.RepositoryActivity, was not found in the project or the libraries
this is my first app ever (github browser),am copying the steps from a video and when i tried to debugg my app to see if i was getting the data for user it crashed
i tried to redo the steps and go over everything i did but it didnt work
Just to be clear, you have two different errors in those screenshots.
The one in the manifest is saying it can't find the Activity class with that name, for the reason outlined in CommonsWare's answer - it's looking for se.linerotech.myapplication.RepositoryActivity, and that's not where your class is. It's in red because it's an unrecognised name/not found.
The other error is in the output window - it's saying you have an Activity class at se.linerotech.myapplication.acitvity.RepositoryActivity which hasn't been added to the manifest. This is true (you tried adding it, but didn't do it right) and every Activity needs to be included in the manifest, which is why it's complaining.
The two errors stem from the same issue, I just wanted to make it clear what each one means, since if you just looked at the error log you might think you've used the correct fully-qualified name for the class (it's right there in the output!). But it's two different sides complaining about the same thing for different reasons.
Class referenced in the manifest, se.linerotech.myapplication.RepositoryActivity, was not found in the project or the libraries
That is because you do not have a class with that fully-qualified class name.
Your class is se.linerotech.myapplication.activity.RepositoryActivity, because it resides in the se.linerotech.myapplication.activity package. Use se.linerotech.myapplication.activity.RepositoryActivity instead of .RepositoryActivity in your manifest.
I have a MonoBehaviour class that has a property referencing another class which is ScriptableObject.
I've created several prefabs of my first class and created several ScriptableObjects of my second class, I've referenced them in the first class respectively.
In the editor everything works fine, except sometimes my so are shown in the Inspector as Missing Script and in property reference as NameOfSO (), don't know what causing this, but again, Play in the Editor is working just fine.
If build my game for Android and connect to the Debug, to see what's going on, I can clearly see, that's ScriptableObject reference is null. Why? Don't know, came here to ask a question.
Thanks!
I figured it out, turns out this was happening because of the weird thing with namings.
Allow me to explain, when I first created a class from ScriptableObject I used, lets say, MyClas name, I've created several instances of that class, but then I saw the error in the name of the class, I've changed it to the MyClass but only in the file itself, not the actual .cs file, so, this was happening. All I had to do is to ensure that my class and my file names are the same, delete old instances of ScriptableObject and create new ones from scratch and... Voila!
Sorry.
I'm building a Xamarin android app.
After xamarin update I get a build error. I can't tell if that is related at all but what worked before now throws an exception: ClassNotFoundException. The class exists and is a proper activity. There was no change in that area at all.
I've seen many SO threads in that regard but they all suggest to clean solution, delete build folder etc. And that doesn't help me unfortunately.
What I realise is that in the exception message
W/monodroid( 4201): JNIEnv.FindClass(Type) caught unexpected exception: Java.Lang.ClassNotFoundException: md56629fa8edd4a41a77563f74c5f9a5f792.MainActivity the md5 part is not the same as the folder where the MainActivity.class resides in (md56b5cfc81a7b5c4227a0c9a4dcb7dab856). When I delete that folder a new one is generated during a build. Its md5 is different again. But the exception reappears, asking for the same old md5 as before.
My questions:
1.) What can I do to make JNIEnv look for the right md5?
2.) How are those md5 generated and why
Thanks.
Xamarin generates an MD5 sum for all types that have a Android Callable Wrapper (ACW), unless you explicitly give it a name. I guess this is done to avoid collisions with other types, which could live in the same package name. These are generated at build time.
In order to set your own name on a type inheriting from Java.Lang.Object, these are types like Activity, Adapter, View and many more. You simply add a Register attribute to your class:
[Register("my.cool.package.MyTypeName")]
public class MyTypeName : SomeJavaType
{
}
For classes such as Activity you can alternatively use the Name property in the Activity attribute:
[Activity(Label = "MyActivity", Name = "my.cool.package.MyActivity")]
public class MyActivity : Activity
{
}
I'm using AndroidAnnotations in an Android Studio gradle project. I currently get error output from AA during compilation that says:
cannot find symbol class MyActivity_
The error output does not prevent building the application - its not really a compile error because the class is there, it seems that it is just an unfortunate timing issue with the compilation process.
Is there anything I can do to avoid these false-positive errors from AA? When there are "fake" errors shown every time I compile, its very easy to miss the real errors.
I had same error. To solve it I have revert my last changes and it has worked again.
I think it was either wrong optimized import(you must import generated classes eg. xxx_) or I injected layout by id what was not existed in the layout xml
Update
I figured it. My problem was what I had use private mofidier instead of proteced in
#ViewById(R.id.list)
private ListView list;
Try to see if you missed to fix some errors in the class MainActivity or in someone of his Bean member that you have annoted.
The problem doesn't have to be in MainActivty, but it is probably because of a private modifier which is used with Android Anotations (in injection, method declaration etc) somewhere in your code
I'm working through a book samples programs and i get the same problem whether I create and type the code or whether i download the code already typed, so i'm thinking it's a setup problem.
I get this error in each each class:
setContentView(R.layout.menu) where the "R" is underlined in red and the code won't compile. If i add import android.r like "QuickFix" suggests, the red line goes away from the "R", but then the red line appears under "menu" (in this example). The same behavior occurs in each of the 5 classes that make up the project.
I do have matching layouts for "menu" etc. And (to the best of my knowledge) I registered them as Application Nodes in the manifest file.
It's driving me nuts. Thanks for any suggestions.
You are not supposed to import android.R as it won't resolve your resources. Just remove that import and try to compile again.
If you are working off a tutorial then also check to have the same resources as in the tutorial and also if you decide to name thing different then keep that in mind an reference them by your names.
The R class is generated by Android and contains IDs for all resources in your res folder. Go to your AndroidManifest and locate the package= attribute on manifest. R is in this namespace. So if the namespace is com.yourpackage.blah, you'll want to import com.yourpackage.blah.R;
The problem was that for some reason Eclipse was not autogenerating the gen/R.java file. I don't know why. One time it did generate the file, and a after Project..Clean and Build All everything resolved. Thanks for the input.
Also make sure your file names under res, eg drawables, are OK. I had a file name with capital letter and that prevented the creation of R with the same reference errors that you got. I did not check the error messages and it took me a good 10-20 mns to find this out.
Sometimes this happens to me.
It usually happens that I have been working with some xml element, and before clicking to a java document to hit "run" i just hit "run" while on the xml. I don't really know what happens when you "run" an xml, but it makes this horible file called some_xml_name.out.xml.
DELETE THIS FILE!
This file is the reason why you get so many R related errors, since the Resources library is never really created, or something like that.
That is my advice, without actually seeing the error you're getting in the console.