Android Question AppCompat library problem

Gdev

Member
Licensed User
Hi all
i have a problem with the appcompat library, I followed the tutorial 1 but when I compile generates error "Packaging files. Error".
If you compile another app that does not use this library works.
I'm using the api 23.

Thank and sorry for my bad English
 

DonManfred

Expert
Licensed User
Longtime User
You should start with uploading your project. Without seeing your code it is hard to give advices.
 
Upvote 0

Gdev

Member
Licensed User
Ok. Then my answer is: it works fine for me with this example.

I guess there is a problem in your setup.
I Followed these steps


  1. First copy the AppCompat.jar and AppCompat.xml files to your custom libraries folder.
  2. Create a "resource" folder in your custom libraries folder if it does not exist.
  3. Copy the b4a_appcompat folder (which includes some resources) to the CustomLibs/resource folder
  4. Start the Android SDK-Manager and download the latest Extras/Android support library!
  5. Copy the android-support-v4.jar and android-support-v7-appcompat.jar which can be found in <Android SDK-Base>\android-sdk\extras\android\support\v7\appcompat\libs to your custom libs folder
  6. In the B4A IDE in your projects check the AppCompat library on the libraries tab.
  7. Make sure that you reference the latest android.jar in the IDE under the "Tools/Configure Paths" menu. The version should match the support library version (For Support Library 23 you should reference android.jar v23)


    I have to take other stepe?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I have to take other stepe?
Yes. Everything in the tutorial behind the 7 steps you quoted
There is a theme you need to define, there are several äadditionalres: commands.
Again: Without seeing your code it is hard to give advices.
 
Last edited:
Upvote 0

Gdev

Member
Licensed User
Yes. Everything in the tutorial behind the 7 steps you quoted
There is a theme you need to define, there are several äadditionalres: commands.
Again: Without seeing your code it is hard to give advices.

this is the code
B4X:
#SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: ..\resource
#AdditionalRes: C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries\resource\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: D:\android sdk\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
#Extends: android.support.v7.app.ActionBarActivity

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private ActionBar As ACToolBarLight
    Private pContent As Panel
   
    Dim si As ACMenuItem
    Dim sv As ACSearchView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")

    'Set the Toolbar (from the loaded layout) as the ActionBar of this activity.
    ActionBar.SetAsActionBar

    'Set Title and Subtitle for the Toolbar
    ActionBar.Title = "AppCompat"
    ActionBar.SubTitle = "SearchView Example"
   
    'Because the Toolbar is part of out layout we split up our layout in a main layout file
    '(which only has the Toolbar and a ContentPanel) and a content layout which has all the
    'visible controls.
    pContent.LoadLayout("content")

    'Initialize the SearchView (make it Iconified by default)
    sv.Initialize("Search")
    sv.IconifiedByDefault = True

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

'Inline Java code to initialize the Menu
#If Java

    public boolean _onCreateOptionsMenu(android.view.Menu menu) {
    if (processBA.subExists("activity_createmenu")) {
        processBA.raiseEvent2(null, true, "activity_createmenu", false, new de.amberhome.objects.appcompat.ACMenuWrapper(menu));
        return true;
    }
    else
        return false;
}
#End If

'This is the Sub called by the inline Java code to initialize the Menu
Sub Activity_CreateMenu(Menu As ACMenu)
    'Clear the menu
    Menu.Clear
   
    'Add a menu item and assign the SearchView to it
    si = Menu.Add2(1, 1, "Search", Null)
    si.SearchView = sv
End Sub

'If the user submits a search then this event sub is called
Sub Search_QuerySubmitted (Query As String)

    sv.Iconfied = True
    si.ItemCollapsed = True
  
    Msgbox("Search for '" & Query & "'", "Search")
End Sub
 
Upvote 0

Gdev

Member
Licensed User
Yes. Everything in the tutorial behind the 7 steps you quoted
There is a theme you need to define, there are several äadditionalres: commands.
Again: Without seeing your code it is hard to give advices.
I solved.
Thank you very much for helping
 
Upvote 0
Top